PHP - How To Schedule A Php Script To Run Automatically.
hello guys.
i need to run a script automatically at scheduled date and time. i am sending bulk emails . i need to setup an email campaign, in such a way that i can schedule like daily, monthly or quarterly.. can u guys give few tips to get it done.. Similar TutorialsI currently have the below code that reads a database to find what time a staff member is scheduled for work and what day. The below code works fine however on the same day it print lets say they work more then one hour it would show Sunday 2a - 3a, Sunday 3a - 4a, Sunday 4a - 5a ..... and so on I would just like it to simply put Sunday 2a - 5a skipping the extra output. $dayname = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); $shifts = array(); $num=0; $days=0; for ($d = 0; $d <= 6; $d++) { $slot = mysql_fetch_array(mysql_query("SELECT * FROM rp_timetable WHERE day = '$dayname[$d]'")); for ($i = 1; $i <= 24; $i++) { $ap1 = "a"; $ap2 = "a"; if ($slot["$i"] == $eusername) { $one = $i-1; if($one >= 12) { $one = $i-13; if($one == 0) { $one = 12; } $ap1 = "p"; } $two = $i; if($two >= 12) { $two = $i-12; if($two == 0) { $two = 12; } $ap2 = "p"; } $shifts[$num] .= $dayname[$d].' '.$one.''.$ap1.' - '.$two.''.$ap2.' EST<br>'; $num++;}} } if($shifts[0] != NULL){ echo"<table><tr><td><strong>Air Shifts:</strong></td><td>"; for ($i = 0; $i <= $num; $i++) { if($i == 0) {echo $shifts[$i].'</td></tr>';} else {echo '<tr><td></td><td>'.$shifts[$i].'</td></tr>';} }} print"</table>"; Hi, This may be the wrong way to do things but I am fairly new to this. I have a mysql database which I store some jobs I run. I usually use schedule tasks for this but was wondering if I could do this more efficiently in PHP. I have a table with days of the week comma seperated and then a column with a time and then a column with the name of the job. I basically need something to kick off a job at a given time on a certain day. If someone can point me in the right direction it would be appreciated and I can usually crack on from there Hi everyone I need some help on how to go about designing a script for a high school. It is for teachers so that they can book periods for the computer lab, studio etc. I want it so when they go to the page it has this week with all the slots taken. What I'm having trouble with is I want them to also be able to go to any date they wish and bring up that weeks schedule because they need to be able to book in advance. Would anyone be able to explain a technique on how I can go about this Thanks in advance I am trying to write a simple method of displaying our meetings schedule for North Idaho Area Narcotics Anonymous it pulls from a MySQL database and I want it to look like this: COEUR D'ALENE Sunday: Group 1 Name Time Group 2 Name Time Group 3 Name Time Monday: Group 1 Name Time Group 2 Name Time POST FALLS Sunday: Group 1 Name Time Ok so my problem is I dont know how to make php create the heading only if there are meetings in that heading so if there are no meetings in POST FALLS then it wont make a list for post falls or if there are no meetings in POST FALLS on Sunday then it wont show the SUNDAY heading. This way it will be maintenance free page just add/delete meetings in the database then go from there. Each meeting name will be a link to an ID corresponding to the unique ID in the database so you click it then read all the info on that meeting. It will be a way for NA members to view the schedule from their mobile phones easily. I have written loops but nothing that would leave out a heading based on lack of a given entry. Any help would be most appreciated. Thank you!!! Chad I'm new here so I say hallo to everyone I have to implement bus time table in this way: Every bus drives every second day from the day chosen. Let's say: If xx bus goes every second day from 23rd February to 30th June to Spain (23rd, 25th, 27th...), How can I check if let's say on 14th May there is bus to Spain? I started with odd and even numbers: if it starts from the even day than there is array of months with number of days, but what if Feb has 29days (every 4th year) instead of 28... I'm totally confused here. In database I have rows: start date, end date and bus name. Is there any other way of implementing this? This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=342882.0 I need help to get flight schedule from http://www.sriwijayaair.co.id/id but always error using curl to access ssl. here are my code: <?php $headers = array( "User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 GTB7.1 (.NET CLR 3.5.30729)", "Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language=en-us,en;q=0.5", "Accept-Encoding=gzip,deflate", "Accept-Charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Keep-Alive=1150", "Connection=keep-alive", "Referer=http://www.sriwijayaair.co.id/id", "Cookie=language=in; location=id; dest=home; __utma=260465999.1394002812.1293106375.1293106375.1293106375.1; __utmb=260465999.1.10.1293106375; __utmc=260465999; __utmz=260465999.1293106375.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)", "Content-Type=application/x-www-form-urlencoded", "Content-Length=121", "POSTDATA=isReturn=false&from=CGK&to=MES&departDate1=30-&departDate2=11-2010&adult=1&child=0&infant=0&returndaterange=0&Submit=Cari" ); // do access to sriwijaya air $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://booking.sriwijayaair.co.id/b2c/AvailabilityServlet"); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_COOKIEJAR, "cookie.txt"); //curl_setopt($curl, CURLOPT_POSTFIELDS, "isReturn=false&from=CGK&to=MES&departDate1=22&departDate2=01-2011&adult=1&child=0&infant=0&returndaterange=0&Submit=Cari"); $curlData = curl_exec($curl); print_r($curlData); curl_close($curl); ?> any help will be appreciate, thanks I have database "raj" with table "pagination"
In table pagination have "id", "actualtime" and "created" field
id - auto_increment actualtime- varchar created- datetime
that looks like this CREATE TABLE pagination( id int auto_increment, actualtime varchar(55), created datetime )
I want to display all rows which are created on todays date and will display from today upto yesterday at 06:00 pm. after that the content will be refreshed based on based on a DATETIME field called 'created' that holds the date and time of each record's creation.
this is my query to fetch rows but it display value after 06:00 pm on yesterday but i want to display all data before 06:00 pm from currentdate. After 06:00 pm data will be refreshed and clear. plz help me......
SELECT actualtime FROM pagination WHERE created BETWEEN date_add(date_sub(curdate(), INTERVAL 1 day), INTERVAL 18 hour) AND curdate()";
I've got a class schedule that spans two years and I would like to have the years as headers. startDate is unix date field. Here is existing code: $sql = "SELECT * FROM classOfferings, classes, instructors WHERE classes.classId = classOfferings.classId AND classOfferings.instructorId = instructors.instructorId AND classOfferings.startDate >= CURDATE() ORDER BY classOfferings.startDate"; if(! $retval ) { die('Could not get schedule: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "{$row['dates']}"; if ($row['hours'] != 0){ echo "</td> "; } else { echo "CANCELLED</td>"; } echo "<td class='cell2'>". "<a href='classDetail.php?seq={$row['seq']}'>{$row['title']}</a>". "{$row['days']}". "{$row['times']}". "<a href='instructorDetail.php?instructorId={$row['instructorId']}'>{$row['fName']} "." ". "{$row['lName']}</a></td>} echo "</td></tr></table></div>"; } Hi there, I am working on a php project on my WAMP server where I have access to XML datafeed from xe.com once a day to get the Exchange rates. This xml datafeed is saved on my localhost as an archived copy. Now I would like to automatically access the fresh xml datafeed file from xe.com once a day and replace (or update) the xml file on my localhost to have the updated information (rates). How can I schedule this task automatically and make php access the updated xml file once a day. All comments and feedbacks are always welcomed Thank you! Hi Folks, I'm creating an equipment reservation system for a client. Every reservation has an equipmentID, ReservationDate, StartTime, EndTime. So, basically my script searches existing records for a given date and EquipmentID. I'm having trouble with how best to approach validation on new reservations to ensure there are no conflicts. Lets say two existing reservations for a given date/equipment are found. One reservation has a startTime of 8AM and endTime of 9AM. The second has a startTime of 12PM and endTime of 3PM. Is there a simple way to check if the user's submitted values for StartTime and EndTime conflict with existing reservations? Any input would be greatly appreciated! Thanks! -John Hi all, I am wondering what the best way to do this is... Take GoDaddy for example, if your domain is about to expire you will get an automatic email. I am wanting to do something similar, If someone orders a Soap Dispenser, I want to send an email (if they accept to receiving emails on the order) each month asking/reminding them to top up on soap. I have been reading but cant find anything adequate, I have seen something about Cron Jobs, but never heard of this before, please could you point me in the right direction. Thanks in advance. Peter Hi, I was wondering if it is possible to have the foreign keys (FK) to automatically assign its value to the corresponding PK (primary key) it references? Let's say I have four tables (with their PK,FK and other fields) Code: [Select] TABLE document: TABLE pathway: TABLE leaf TABLE value: PK: docID PK:pathID PK:leafID PK:valueID filePath pathway FK:pathID FK:leafID fileName FK:docID value target source So when I upload a document, it is added to TABLE document, where PK docID set, and at same time I would add the filepath to TABLE pathway, and now I want TABLE leaf's FK to AUTOMATICALLY add the pathID, docID and ALSO at same time TABLE value's FK of leafID will also be added for that ONE entry that was initally added to TABLE document, pathway. Please I hope someone understand what I want to do, I know FK is for ensuring integrity of data. Please any help is appreciated. Please use my example to help me, thanks. PS: I know the formatting is off which I noticed when I went to preview the post, sorry. Hello, I am new here but I hope you can help me with a problem that I've been stuck with for days. I am trying to populate the content of a website through XML files (zipped) that are located on an FTP server. I managed to get the zip file but I'm not sure if it is the correct way: Code: [Select] function ftp_copy($file) { $conn_id = ftp_connect($ftp_host) or die ("Can't connect"); $ftp_login= ftp_login($conn_id, $ftp_user, $ftp_pass) or die ("Can't login"); ftp_pasv($conn_id, true); ftp_chdir($conn_id, "/zip_files/"); return ftp_get($conn_id, $file, $file, FTP_BINARY); } ftp_copy('1001.zip'); After that I will need to extract the zip file. I'm planning to use pclzip library for it and save the contents on a database. Also this has to happen everyday so I'm thinking about using a cron job, although hourly is also preferable since the XML files could be generated more than once per day. Am I doing it the right way or is there a better solution for this? Any help will me much appreciated! Thanks a lot! Hi Guys, I have the following $pattern = '<tr class="newsitem">'; when I echo this out it produces <tr class="newsitem"> </tr> Why is it automatically closing the tag? I dont want this becuase i'm using preg_replace and the tag is closed elsewhere already on the page. Hi,
I have the following function, but told I need to run it automatically. How would I do this?
<script> function replaceText() { var list = document.getElementsByTagName("UL")[22]; var list2 = list.getElementsByTagName("LI")[29]; list2.getElementsByTagName("LABEL")[0].innerHTML = "Car"; } </script>Thanks! Hello friends, In this topic i am getting confuse, and never know how to do work. My problem is that: 1>> I want to send SMS, by PHP pages to mobile. 2>> If user write some Quotation into the calender date, then automatically SMS send to all of those friend with the quatation metter. 3>> All work is store also in MYSQL database also. So please tell me what I do in this case because over the internet only SMS sending code is available, but automatically sms sending option is not given. Please help me then i do this job easily. Thanks Hi, I've been wondering if it is possible to load a php page according to certain time. For example at 12:00 pm a php form will pop up automatically informing an employee to fill in something in the form, another form will pop up at 4:00 pm, etc... Thanks in advance I'm wanting to make a sitemap for my website but as it's quite big there are a lot of url's I need to include. I was wondering if anyone know's of a way this can be done using PHP. e.g. using PHP to generate a list of URL's. I had a think myself but wasn't sure how to do it. Thanks for any help. |