Wrong Dates In A Schedule
I am using the following code (many thanks for the code folks BTW) to
generate 3 schedules in three tables one is a schedule with 7 day
intervals and two are daily schedules.
The two daily schedules seem to have out of sync dates at the start of
each schedule. The dates look as if they may be dates from the
preceding loop.
I am presuming that I need to reset something after the completion of
each loop but I am not sure what.
$now = time();
$day = $now + 7*24*60*60;
$cutoff = strtotime("+$months months");
while ($day <= $cutoff) {
$date = date('Y-m-d', $day);
$insert = "INSERT INTO daily_data SET subscr_id='$subscr_id',
date='$date'";
mysql_query($insert);
$day = $day + 7*24*60*60;
}
//then create a daily schedule in the excercise table
for($i=0;$i<=($sched);$i++)
mysql_query("INSERT INTO exercise_data SET subscr_id='$subscr_id',
date=date_add(now(),INTERVAL
LAST_INSERT_ID() DAY)");
//then create a daily schedule in the food and diet table
for($i=0;$i<=($sched);$i++)
mysql_query("INSERT INTO food_data SET subscr_id='$subscr_id',
date=date_add(now(),INTERVAL
LAST_INSERT_ID() DAY)");
View Complete Forum Thread with Replies
Related Forum Messages:
How To Set Up Multiple Dates For Schedule?
I have a question about how to set up dates in my mysql database. I am setting up a show schedule database for a friend at a local college tv station. This would normally be pretty straight forward and easy. The problem lies in the fact that their show lineup is not huge, therefore they air most of their shows that the students produce up to 5 times a day and also some of these shows -not all- come on all week long (Sunday thru Saturday) and some only come on one or two days out of the week. My database (so far) contains the following tables: ...
View Replies !
Offering Dates And Booked Dates In A Table As DATE Datatype Using MYSQL.
Availability dates in offering dates except booked dates. For Example: Offering dates are : 01-09-2005 to 27-09-2005 01-11-2005 to 30-11-2005 Booked dates are : 10-09-2005 to 23-09-2005 Availability dates should be 01-09-2005 to 09-09-2005 24-09-2005 to 27-09-2005 01-11-2005 to 30-11-2005 I am storing offering dates and booked dates in a table as DATE datatype using MYSQL. So, I want the above mentioned availability dates as a result.
View Replies !
Schedule
Currently, I have a database that stores a course schedule. For example: Course Title, Start Time (datetime), End Time (datetime), Mon (T/F), Tues (T/F), Wed (T/F) Thurs (T/F), Fri (T/F) I want to take this data and graph it as a visual calendar using tables. For example: Time Monday Tuesday Wednes ... 10:00AM WS1093 10:30AM WS1093 11:00AM WS1093 11:30AM 12:00PM EH2312 12:30PM EH2312 1:00PM EH2312 Something like that. What's the best way to do this? Clearly, I could make a an html calendar and load it up with a bunch of if statements but is there a more elegant way to fill in the calendar? Are there any classes available to easily do this? Code examples are very much welcomed!
View Replies !
TV Schedule?
I've seen this on a number of TV sites, where on the front page they tell you what's playing at the time you're browsing, what's coming up next, etc. I want to do this for a site I'm working on, but I have no idea where to start.
View Replies !
Schedule And Php.exe
i am making an installer for a shoutcast control panel i have designed http://sourceforge.net/projects/cast-control it runs on both windows and linux I have made a bitrate controller that runs a batch file or cron job (depending on the operating system) which will run a php file with php. In the batch file i have c:/php/php.exe "D:/pathto/shoutcast_cpanel/bitrate/bitrate.php" The problem is that i cannot include the database.php file which is in the same directory as bitrate.php. I was wondering how to make this possible or at least include the database settings from the file somehow. The reason im not just running http://serverurl/bitrate/bitrate.php is because under windows it opens up a new windows in explorer for every time.
View Replies !
Schedule Job
i need to schule a php script to run once a month in apache/windows environment. what would be the easiest best way to accomplish this task?
View Replies !
Creating A Schedule
I am building a diet/weight loss website where a customer would subscribe for 1,3,6 or 12 months. I am using Paypal IPN to handle the subscription payments. I would like to create a schedule when the customer first logs on, from the date they signed up to the date when the subscription ends and every 7 days is highlighted as the weigh in day. Basically I would like to generate a list of dates from one date to another with every 7th day highlighted.
View Replies !
Schedule Emails
Has anybody every attempting scheduling emails or trigering any event from a php site? for example, everyday at 10:00am call function x(); ?
View Replies !
Schedule Script Run
I need to schedule a php script to be run daily at 12.30am. What command can I place in my crontab to do this? I'm confused because a web browser is required to run a typical php script. I thought about lynx, but I'm not sure how to run it, and then exit after it runs.
View Replies !
Schedule My Classes
if it`s a good idea try to do a class scheduler in php HorarioEX.htm this is the visual part of what i want to do. the idea is the user insert the code of the class it`s called CRN, then appears on the table with some color and thats all. So do u think its a good idea to try with php ? or i should try javascript or another source?
View Replies !
Schedule Script
Is there a way to get my script to run on regularly scheduled intervals without using cron? My hosting provider sucks. cannot use cron. I was thinking perhaps I could create a file every hour in a certain directory and then fire the script when the file count reaches a certain number, and then clear out the directory or something like that.
View Replies !
Dates In Range Falling Between Existing Dates
The latest quandry I have is that I need to: a: check whether any dates in a date range entered by a client in a form (datefrom, dateto) conflict with any existing date ranges already in the database. -this is a check to see whether the dates that a customer is trying to book are not already booked- Obviously its easy to get the numbers out of the database (i.e. 28/12/2006 or whatever format) and from the form but how to I convert this 'range' actually into a range I can loop through that will return true if any of the dates are the same (i.e. already booked)? b: is similar in that I want to check how many of the clients entered dates fall into the pre assigned high, mid and low season ranges in the database and multiply each of those days by the corresponding price.
View Replies !
Simple Calendar/schedule
I'm looking to develop a simple php calendar/schedule - similar to outlook calendar - that does not rely on a database but rather writes to a file. I need to be able to add to/delete from the schedule. As I am only starting out with php I am a little confused by the codes which links to databases and how to adapt them to only write to a flat file.
View Replies !
Calculate A Firefighters Schedule In PHP
I need to calculate the following schedule in php. What I need out of the script is what shift is working “today” E.G. $shift = d;. There are 4 shifts working 24hr days starting at 7 am. The days rotate on 28 day cycles. E.G. ‘C shift’ is working on July 1 (Sunday) the next Sunday they work is the 29th. I found some code that works with 3 shifts on a different cycle but I have 4 shifts. Code:
View Replies !
Calender Script/Schedule
Does anyone have any recommendations or tips on where I can go to find a good scheduling script or a tutorial to make one? I'd perfer to make my own for security reasons so I know the code and for later addons. Basically I need to re-create something like http://radio.virtualdj.com/schedule/schedule.php where djs can login to book a time on the online radio and then it blocks the slot off.
View Replies !
Allow A User To Schedule A Stay
I am trying to code a program in PHP that would allow a user to schedule a stay at this place, it would save that to a database. If a particular day has 5 people booking it, it is no longer able to be scheduled. I can't get the scheduler page to check how many people have booked or my calendar to display a day in red if it is booked.
View Replies !
How To Schedule Tasks On Website.
I am trying to figure out how to schedule tasks on my website. For example, PAGE1 should perform a different task in the morning than in the afternoon. And at the end of the day, I have to extract some data from the database and put them into a file. This should be done automatically.
View Replies !
Schedule Mail Sending
I need to send an newsletter as an email that is scheduled. The user will prepare the newsletter and save it in database. He will also input the scheduling option i.e date and time the newsletter has to be sent. I have a table Newsletter_T where newsletter contents are being saved and Contacts_T where the email address resides. I am using PHP 5.2.3, Apache and MySQL.
View Replies !
Send Email With Schedule
I want to create an option to the user to suscribe to a service that sends an automatic mails everyday with information taken from a database created in MySQL. I have the form and the access with PHP to the database and I can send an automatic mail at the moment that the users press a button to activate the action, but I do not know how to do it everyday (or the period of time chosen by the user).
View Replies !
Creating A Schedule Script
I have a league based web site and I'm looking to make a script that can make a schedule of matches. Last year I did alot of hard coding with a ton of if statements (not very fun). There are 2 vars. how many weeks you play number of teams.
View Replies !
Schedule A Cron Job With Php Script
Is it at all possible to schedule a cron job from a php script? Perhaps cron isn't my best option. I need to have a script run automatically at one specific time and not repeat. The way I was thinking of doing this is to schedule a cron job, then when it runs remove it from crontab. Is this possible, or even the right solution?
View Replies !
How To Schedule Jobs On A Host?
I'm using a php hosting company for my website. It seems most php pages are user-event triggered, so it is difficult to schedule something to run regularly. For example, user puts something in discussion board, and I need to update my search index to include it. Since building index is pretty IO intensive and takes long time, I hope to do it once a day when traffic is very low or zero so it doesn't impact server performance. I can't really rely on user events to trigger such things. For example, user won't expect his click would trigger a 20 minute delay so I can piggy bag an index-build at the page handler, and there might not even be user clicking my site at the time I desire. Is scheduling for jobs (or something similar) achievable using regular PHP? (I don't have shell login, etc. for the typical PHP hosting service).
View Replies !
Setting Up A Time Schedule?
I have a php script that needs to run 6 times a day, the documents that came with it suggest that it should be setup as a cron job, but where my site is hosted, I'm unable to do this. so I thought that maybe I could setup a php time schedule, so that the script will run inbetween these times when a users hits the site: 12am-1am 4am-5am 8am-9am 12pm-1pm 4pm-5pm 8pm-9pm but also I'm wondering how the script could keep track if the script has already been ran for a particular time period.
View Replies !
Table With Weekly Schedule From A Database?
I'm designing a site for a community radio station and the schedule needs to be generated from the list of programs that are in the database the shows table has the following colums show_id, show_name, day, start_time, end_time (i didn't list the non-relevant ones for this portion of the site) because a table has to be built left to right instead of top to bottom (cell for monday 8am then tuesday 8am instead of all the monday then tuesday etc) and not all the programs are the same length (i think i can use row span="x" depending on the length of the show) I'm quite lost. should i have other colums? how do i query the database to pull the data out in the proper order and build the table?
View Replies !
How Would Watchers Know, Without A Cyclic Check On MySQL Schedule Table About Task Validity?
I have developed a PHP-based website where a "planner" user can make up schedules of activities to be performed, storing them into MySQL tables. Afterwards, other "watcher" users can connect to the website and retrieve closest task due time, and keep retrieving next task after each one has been performed. The problem arises if the planner asynchronously changes the schedule, e.g. deleting the task "watcher" users consider to be the next one, or inserting a closer one. How would watchers know, without a cyclic check on MySQL schedule table about task validity? I would need a sort of asynchronous server-pushing tecnhique towards watcher's browser when any schedule modification occurs. Would you say this could be done with PHP alone?
View Replies !
Get Dates Between Two Dates, Then Add To Table
I've got a form that inserts data into a database. Basically what it sends is a sets of dates. What I'm wanting is another set of inputs that also sends some dates. But before it adds them to the database I want to query the dates and find all of the dates between the two given ones and add them to the database as well. Code:
View Replies !
What's Wrong W/this (if / Or) ?
When ppmode is set to "cancel" or "thankyou", the header and exit are still processed. I'm trying to search on "if" and "or" in google, but it keeps removing "or" from my searches. Is there something wrong w/this ? if (($ppmode != "cancel") or ($ppmode != "thankyou")) { header("Location: index.php"); exit(); }
View Replies !
Wrong Id
I have a table named 'choose' with the fields site_id, user_id and values, with 2 rows : row1 : site_id = 1 user_id = 2 value = 0 row2 : site_id = 4 user_id = 2 value = 0 I use the following form, that get's it's info from another table Code:
View Replies !
Wrong Headers
I just transfered and patched up some files because I moved them from Linux/PHP/Apache/mySQL to Windows XP Home/PHP/Apache/mySQL. I fixed all the problems that come up, but, when I load the page in IE6, it reloads a bunch of times and just loads normally. I tried the best I can to make the page HTML 4.01 Transitional. So, on Linux, after I patched the page to be HTML 4.01 Transitional I put a link for my visitors to validate my page if they want to. So I notice also, that when I validate the page, I rarely get it to work. 90% of the time, this is what I receive from the W3C validator: Quote: I got the following unexpected response when trying to retrieve <http://*****/>: 500 Bad header: ' <img src="/images/menu/other_stuff-off.gif" alt="Other Stuff" name="menu-other_stuff" width="186" height="17" border="0">' Please make sure you have entered the URI correctly. I get this error most of the time, but sometimes there is a different part of my PHP HTML output in the page. And then, when it works, half of the page is trimmed off, thus, I get errors about my page not being HTML 4.01 Transitional. I tried a couple experiments with my layout code, and the same code makes the browser reload, and reload... I've tried debugging my layout code but it brought up nothing... I switched from the PHP module to using the CGI executable. Some things changed: The page no longer reloads repetitively; when the validator fails, I sometimes get a 'Header too long' message; using the validator brings success more often, but other letters are in the output (degree marks, little squares -- these don't appear when viewing the source of the page in IE6). Anybody know why this header is being sent by my server? *Note* I am not trying to load an image. I am trying to load a dynamic PHP page.
View Replies !
What's Wrong With This Code?
I keep getting parse errors on line 10 (the "if (isset($LOGINID)) {" line). Can any of you figure out why the hell I keep getting this? Is is just something simple I'm overlooking? And if you have any comments on my code (security, structure, tips, etc), I'd like to know as well... [edit] Oh yeah, the db_connect, db_array, db_query, and decrypt functions are all defined in database.php and crypt.php. PHP Code:
View Replies !
What's Wrong In This Code
$link = mysql_pconnect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD); $selectStmt = "SELECT * FROM user_profile WHERE userid = 'david'"; if (!($result = mysql_db_query($DB, $selectStmt, $link))){ header("Location:http://$HTTP_HOST/$DOCROOT/error.html"); exit(); } here is the case, the userid 'David' is NOT in the table 'user_profile', the program should launch the error.html, and exit(), But it is not.
View Replies !
What's Wrong With This Php Code?
I put the following php code inside my index.html page. I upload it to my host server (free.prohosting.com), change the extension to php (and another one with php3)and CHMOD it to 644. When i viewed it in a browser, the normal html appeared but the items inside the php code failed to appear. Can somebody help me to confirm whether there is something wrong with my php code (it is a news grabber code) or is it because my webhost don't support php (the unofficial FAQ says that the server support php). If there is something wrong with my php code, here is the code: PHP code:
View Replies !
What Am I Doing Wrong With This Regex
I'm just trying to check and see if this name is valid. I submit things like "12345" and it evaluates to true... function checkName ($name) { $status = FALSE; $pattern = "/^[A-Za-z]+$/"; if (preg_match($pattern, $name)); $status = TRUE; return $status; }
View Replies !
Preg_replace - What Is Wrong Here?
preg_replace - What is wrong here? Suppose I have this: $words = array('piece','people'); $profile_text = "I would like to meet people to help me to work in the world piece project."; $marked = MarkWords($profile_text, $words); Should return the same sentece but with the 2 words replaced with the <span> tag, am I wrong? function MarkWords($profile_text, $words){ for($i=0; $i<count($words); $i++){ $patern[$i] = "/@".$words[$i]."/"; $replace[$i] = "<span style='color:white'>".$words[$i]."</span>"; } // print_r($patern); // print_r($replace); $pro = preg_replace($patern, $replace, $profile_text); return $pro; }
View Replies !
Something Wrong With $_POST
I don't seem to be able to access the keys in an associative array. I have a script that dynamically generates a form. The form element names are generated based on image filenames, so I can't just access them the normal way in the form handler script. I tried looping through the $_POST array like this: foreach ($_POST as $key=>$value) { echo $key.'=>'.$value.'<br>' } and i get this output: 0=>Pay 1=>Pay 2=>on 3=>on 4=>tn__DSC2602.jpg 5=>tn__DSC2603.jpg Thos numbers are where I expected to see the form element names. Can anyond advise me on why this is happening?
View Replies !
PHP.ini File Wrong?
I run a test server of apache/php/mysql on my laptop. I just switched from one to another and I'm moving everything over. I downloaded the latest versions of each. (Found that apache 2.0 doesn't work very well and went back to 1.3) Everything is working, DBs are being hit properly and such except: $SERVER_ADDR is no longer being passed back to PHP. When I run PHP_INFO() it shows up there as 飗.0.0.1' as expected, but I can't pick it up in my code. I'm guessing there is something going on with the variables I have turned on/off. Any ideas?
View Replies !
What's Wrong With My Script?
<?php include"dbconn.php"; $db=mysql_select_db(creative_Articles,$connection) ; $Parent="SELECT DISTINCT 'Cat_Parent' FROM Category"; $mysql_Parent=mysql_query($Parent); while ($row=mysql_fetch_array($mysql_Parent)) { $Cat_Parent=$row["Cat_Parent"]; echo "$Cat_Parent"; } ?>
View Replies !
|