Update Content Every 24 Hours
I'm looking for some basic guidance on the best method to automate the following task:
1) Pull some basic data / image from a database.
2) 24 hours later go back to database and redo the above to replace current content with new content.
I've looked around and can't find scripts close enough to the above for me to work out the best way to approach it. I know it involves two basic concepts:
1) Some sort of date / time comparison to control the 24hr update sequence (no date or timestamp is included in the Db table to be used).
2) Some way to randomly pick replacement content from the Db by id number.
Any suggestions or script samples are welcome. Not looking for any finished scripting here just pointers / samples on how best to approach it.
View Complete Forum Thread with Replies
Related Forum Messages:
Find Difference In Hours- Edit Code From Days To Hours?
I'm trying to find the difference in hours between one date from another, and my code currently finds the difference in days- could somebody edit the code to use hours instead of days? $expirationdate[0] = $row3[datetillcompletion]; $startdate[0] = date('Y-m-d'); $startdate = strtotime($startdate[0]); $expirationdate = strtotime($expirationdate[0]); $delta = $expirationdate - $startdate; $final=round($delta/86400);
View Replies !
How To Update Content In Xml File?
Basically I want update the content in "parentnav": <?xml version="1.0" encoding="UTF-8"?> <PAGE> <type>1</type> <parentnav>0</parentnav> <body><![CDATA[<p>sometext</p>]]></body> </PAGE> To be this: <?xml version="1.0" encoding="UTF-8"?> <PAGE> <type>1</type> <parentnav>1</parentnav> <body><![CDATA[<p>sometext</p>]]></body> </PAGE> I have been using "simplexml_load_file" on my site to pull in my xml files.. but now I need to update an xml file with a $value. How do you do that.. after much searching I still don't understand.
View Replies !
Content Update Notifications
I've decided to give PHP a try, i wish to create a system on a dedicated server that checks a specific folder for files that contain the date in the filename ("20070117") and does this every day before a specific time. If it finds out the folder has been updated it sends a mail to a given e-mailaddress... perhaps only sends an e-mail when an update has NOT been received. Code:
View Replies !
Update Page Content From A Form
I want to have a web page that uses variables from a text file as some of its content. I want another page with a form that will allow me to updated/change the variables in the text file. I have no need to add variables using the form only change the values of existing variables. Basically I want to make some content on one of my pages update-able using a form; not entire paragraphs just single words that I have laid out in a table. I have been told that I should just use something like mySQL for this. I do not know if it is necessary since I only want to do it to one page.
View Replies !
Update The Content Of An Element In My Array
foreach ($consumers as $key => $consumer) { if ($consumer ['transstatus'] == 'OK') { $consumers [$key] ['transstatus']= "Payment Successful"; } } I am trying to update the content of an element in my array above. The consumers array contains the data is created by an sqlquery.
View Replies !
Dates 23.00 Hours To 0.00 Hours.
I have the following code $day1 = mktime (0,0,0,1,1,$year); $days = ($week - 1) * 7; $d = strtotime ("+$days days", $day1); $dow = date('w', $d); $sunday = strtotime ("-$dow days", $d); $saturday = strtotime ("+6 days", $sunday); to give me the timestamp on sunday and saturday for a given week and year. The problem I have is that it's giving it at 23.00 hours when i need it at 0.00 hours. 1179010800 translates to Saturday, May 12th 2007, 23:00:00 (GMT) Can anyone see the problem?
View Replies !
Use A Content Type Application/zip, And A Content Disposition With The File Name (test.zip)
I was able to use Ethor's suggestion to fix a problem I'm having. My original problem was that I was missing the quotes around the filename in the CD header. I've read the ensuing dialog between Ethor and JD and have a question/comment driven by the fact that things don't seem to work for me the way they're "supposed to" and I wonder why. I use a content type application/zip, and a content disposition with the file name (test.zip) just like JD suggests. But it only works if the HTTP request ends with ".zip". My request is http://a.b.c.net/cc/production.php?file=123&zip=.zip I get a valid zip file downloaded, but the filename isn't the filename in the CD header - its cc.zip. Furthermore, if I make the request http://a.b.c.net/cc/production.php?file=123&zip= (no .zip on the end, which is what I wanted it to be), it doesn't work at all. The dialog box that pops up is making the filename ?file=123&zip= (Note: I'm using IE as the browser. My server is remote from where I am, and I go through all kinds of route point and a VPN to get to the server. Also note that this works when I browse to my local machine.) I've tried various combinations of application/zip, octet-stream, lower/upper case, quotes/no quotes, order, etc. All have the same result described above. The only two headers I specify in PHP are the CT and the CD. I making a SWAG that some device between my browser and the remote server is monkeying around with the request and/or response headers. Otherwise why would the response headers that my PHP application has correctly applied? Is there something in the Apache or PHP configuration I need to look at? http://eye.cc php newsgroups
View Replies !
Using The 'Content-type', 'Content-Disposition' And 'readfile'
I've been facing a problem I couldn't solve, I don't know how to serch for it in the list's old messages, so I'll tell you what it is and see if you can help me. I have this lines: if (isset($_GET['download']) && ($_GET['download'] >= 1)) { if ($_GET['download'] == 1) header('Content-type: application/doc'); else if ($_GET['download'] == 2) header('Content-type: application/rtf'); else if ($_GET['download'] == 3) header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="' . $_GET['file'] . '"'); readfile($_GET['file']); } It should show to the user an dialog to the user, so he can choose to save the file or to open it directly. The dialog shows and the user chooses, and here comes the problem, by using the 'Content-type', 'Content-Disposition' and 'readfile' the content of the page I'm in is "attached" to the end of the file I'm downloading. When it's an DOC or RTF file, the content of the page doesn't affect the funcioning, but if it's an PDF the string taht goes "attached" in the end of the file happens to make the file useless. All I want to do is to use some routine to let the user choose to save the file or to read it directly, nothing more, nothing less. I have been trying to solve this problem for at least some weeks, and I couldn't find some information that could really help me. BTW, at php.net I found the following example: <?php // We'll be outputting a PDF header('Content-type: application/pdf'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename="downloaded.pdf"'); // The PDF source is in original.pdf readfile('original.pdf'); ?> I used (as can be seem) this example with some modifications, but not too much, and it happens that it's useless for my needs, if someone knows how to fiz it or some other way to do what I want please let me know, I'll be very grateful.
View Replies !
XML Content Syndication And Content Management System
I have several folders of news stories in XML format on my server running PHP, MySQL, apache. What's the best way to dynamically grab the xml files and display them? Is there an existing news content management system that would allow me to specify which XML stories I want displayed? Allowing me to QC news stories and approve/ban them via an admin screen?
View Replies !
Hours &
I'm selecting from a database a time looks like this: 1170229906. I'm trying to find a way to print the hours & minuted differences between each couple, when I'm using while ($rs=mysql_fetch_assoc($result)) {. For example, if the first time is 1170229906 and the second is 1170240253 - the result should be 2:53.
View Replies !
Add One Day (24 Hours) To A Date From
I'm having some trouble getting a grip on PHP's date handling. I've got my dates stored in a MySQL "datetime" column and I'm wondering, what is the best way to add one day (24 hours) to a date from that column?
View Replies !
Add Hours To A Date
I want to show a date coming from mysql (datetime format) to users, logging on from different timezones. Each user has it's own time:When a user logs on a session is created which hold the the time difference from the servertime e.g. user John has $_SESSION['mytime']=2; which means user John is in a timezone 2 hours later than the server. Now if a servertime gives a datetime value of 2002-20-10 18:15:05 How can I make it display 2 hours later, so it will show 2002-20-10 20:15:05? I know mysql has a Date_add function, but I want to keep my queries as they are already, and keep my datedifferences calculation in my include file. So I am looking for a PHP-coded solution.
View Replies !
Add 16 Hours To Datetime
I have a mysql database table that gets the "datetime" column automatically filled when a user fills in the php form page. $curdate = date("Y-m-d H:i:s"); Trouble is, the database server is in the USA which is 16 hours behind my time. Does anyone know a way to change this so that the 16 hours get added to the datetime?
View Replies !
Allow To Edit Within X Hours
I have data that is inserted into a database, one of the fields is named 'time_stamp' and is a "datetime; 0000-00-00 00:00:00" type. I was wondering how one could make an if statement that will show code (code is just the editing portion of the page) if the 'time_stamp' is less than the 'time_stamp' + 72 hours. Other wise, don't show the code and inform them that they can no longer edit.
View Replies !
Mins To Hours
i have a form when submitted hte php file the data is picked up by uses the timespan function to work out the time between two times given byt the user then it converts it into minutes. no on anouther page i want to be abe to convert it back into hours but when i put /60 after the variable it doesnt work it out correctly instead of the time being 11:59 hours it says 11.983333333333 . so how can i get it to convert back into 11:59?
View Replies !
Date() Being Off By 23 Hours
I have the Unix time stamp "1184616000" which I place into date('F j, Y h:i:s A', 1184616000) and I have tested it on two servers which produce "July 17, 2007 12:00:00 AM" but on some other servers it produces "July 16, 2007 01:00:00 PM". Since it is a pregenerated timestamp the date() output should be identical regardless of where it is executed. I am trying to figure out which is right and which is wrong. Can some people please try this out and let me know what you get?
View Replies !
Convert Hours
I've been trying to figure it out for hours and I'm tired because I know it isn't that difficult. guess it's just late and I can't think right. Anyways, so I have a lot of hours. Let's go with 8786 hours for example. I need to convert that to look like"___ years ____ days ____ hours".
View Replies !
24 Hours Dissapearal??
I have a page where it grabs stuff from one of my tables, and only like a few people have access to that page and I wanted to know if there was a way that like when the people that have access to take page selects one of the names or w/e it takes it off of the page for 24 hours.
View Replies !
Detect 6 Hours From Now
I'm doing a time ban and so when a user is banned obviously for datebanned i have time(). So on my unban list I basically want to take the time() function and add 6 hours to it so it still stays in the number format and then insert it into my database. How can I add hours and so forth accurately?
View Replies !
Hours To Man Days
I know this is prob easy but i've looked around and can't find what i am looking for, plus i'm a little bit of a newb. I have a group of total hours for a bunch of workers,, i.e each is like 280 hrs and i need to display these set of hours in another way, i need to display them in total man days instead and a man day for me is 6.5 hours now i know i can just divide 280 by 6.5 in php but that gives me something like: 43.076923076923076923076923076923 i need it to output in a format something like 43 days + 1 hour (or minutes if less than an hour)
View Replies !
Counting Hours.
I have a Rota Submission page, which allows staff members to submit changes in rota, detailing their hours (start and finish), with additional hours if they're doing shifts, or an option for not being online at all. Code:
View Replies !
Time Is Off By 2 Hours?
Whenever I create a new php file and use the date function like so <?php echo date("g:i"); ?> My browser outputs the correct time (I believe i am GMT-5:00) the first few times the file is opened, then the time becomes slow by 3 hours every time it loads (ex: 7:00pm my time shows up as 4:00pm on the browser screen). Is there a simple way to add 3 hours in the date function?
View Replies !
Adding Hours To Time
Whats the most effective way of adding 3 hours to a time in the format of 1:30 (h:mm), and turning it into a 24 hour format? I was thinking of turning it into a timestamp and working from there, but it seems a bit inefficient.
View Replies !
Finding Records Within The Last 48 Hours?
I can't seem to find anything on querying to find records dated within the last 48 hours. Not just two days/calendar dates, but 48 actual hours. I'm hoping to do something like: SELECT record FROM table WHERE postdate > (NOW - 48hrs) does that make sense?
View Replies !
Adding 5 Hours To A Time Using PHP?
I would like to take a date of this format: DATE("Y-m-d H:i:s") and add 5 hours to it. Is there an easy way it can be done? I was thinking about just changing the string, but there's too much to acount for (leap years, etc).
View Replies !
Figuring Out When 2 Hours Have Passed
What I'd like to do is this. get a date and time and determine if it has been a certain amount of time since then. For example, I make an entry in the database of 11:00pm, and I want to periodically check, and if it is 1:00am or later, then I would update the database. Any suggestions?
View Replies !
Last Twelve Hours Echoed
I am so tried but can someone help and show me a basic way to only display the last twelve hours of results from the MySQL? I have a column with the time, how do I only show the last tweleve hours?
View Replies !
Server Time +8 Hours
I'm inputting a DATETIME timestamp of $now into my table <? $now = date("Y-m-d H:i:s"); ?> - which enters the exact time of update into the table. The problem is, is that I'm in Dublin (GMT) and the hosting server is in the US 7 hours behind. so if I entered data at exactly midday in dublin, the value displayed is 5am. Can someone guide me as to how I can alter the variable [b]$now[/b] to show Dublin time?
View Replies !
Date() Output 23 Hours Behind
Using a UNIX timestamp for "June 26, 2007, 12:00:00 AM" I compared the output of two calls to the date() function. One on a Windows server running PHP 5.2.1 and another on a Linux server running 5.0.5. The output on the Linux server is 23 hours behind the output of the Windows server, showing "June 25, 2007, 1:00:00 AM". The code is identical. Only the PHP and Apache version and the operating system vary. Time zone is not a factor as this is a pregenerated integer value for a future date. What could be causing this discrepancy?
View Replies !
Query Based On Last 24 Hours
i have tried googling for the syntax to run a query that can count the amount of new entries into a database based on todays date. I have a field in my database called sign_up_date which is of type datetime and has a default of 00-00-0000 00:00:00 $query = "SELECT COUNT(id) FROM users WHERE signup_date=........... ?
View Replies !
Make Cookie Last 24 Hours.
How do you change this code to expire in 24 hours instead of at a certian day and time? if ($whatever->whatever2['whatever3']) { if (!$_COOKIE['hacked']) { setcookie('hacked', Ƈ', 1143964800); } elseif ($_COOKIE['hacked'] < 3) { setcookie('hacked', $_COOKIE['hacked'] + 1, 1143964800); echo 'HTML CODE GOES HERE.' exit; } }
View Replies !
24 Hours Format Times
how do i go about working the elapsed time in hours beteween two 24 hour times: heres my general code PHP Code: <?php $to = $_POST['totime'];Â Â Â ///// first 24 hour time $land = $_POST['landtime'];Â Â Â ///// Second 24 hour time $ICAO = $_POST['LandICAO'];Â Â Â ///// Landing Airport $frame = $_POST['frame'];Â Â Â ///// a/c Frame Number $fnltime = "$land - $to"; echo $fnltime ?> problem being i need to to still be able to work it out if the person set one time as say 1800 and the 2nd time as 0200.
View Replies !
Update Query - Way To Update All Records That Meet Only A Part Of Field
I know that if you use the following code.. UPDATE table SET field = "" WHERE field1 = "" than it will change `field` in all records that meet the criteria of field1. What I need to know is there a way to update all records that meet only a part of field1 ie... UPDATE table SET field = "yummy" WHERE field1 = "apples|oranges" if field one contains apples|oranges|grapes it would still pick up that record.
View Replies !
Delete Query Takes HOURS
why on EARTH would this query: Code: DELETE FROM `test_zip_assoc` WHERE id > 100000 take an entire day when there are 10 million records in this database: Code: +--------------+------------------+------+-----+---------------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+------------------+------+-----+---------------+----------------+ | id | int(12) unsigned | | PRI | NULL | auto_increment | | f_id | int(12) unsigned | | | 0 | | | zip | varchar(5) | | | | | | lat_radians | decimal(12,11) | | MUL | 0.00000000000 | | | long_radians | decimal(12,11) | | MUL | 0.00000000000 | | +--------------+------------------+------+-----+---------------+----------------+
View Replies !
Redirecting - Session Lasting 24 Hours
I have this page called explore.php/index.php?random=explore, and there's this thing where you start a session lasting 24 hours saying that you have only that amount of time to go to these pages (index.php?random=place&cmd=$anyplace). In case you exit that page and go to a different page on the website, how can I make it so that when you go back to index.php?random=explore and the session still exists, it redirects back to the last place you were in index.php?random=place&cmd=$anyplace?
View Replies !
Expiry Time In Working Hours
Im writing a small application to time software projects. When a developer logs a query, they have to specify the estimated time it will take in working hours. I would like to state the estimated closing time, taking into account that the business works 09:00 - 17:00 Mon-Fri Code:
View Replies !
Finding Difference In Hours Between Two Times?
I recently switched this code to subtract days to hours, but it isn't working.. it's coming out with "343957987" hours and crazy stuff like that. Here's my code- $expirationdate[0] = $row3[datetillcompletion]; $startdate[0] = date("l, M dS (h:i a) "); $startdate = strtotime($startdate[0]); $expirationdate = strtotime($expirationdate[0]); $delta = $expirationdate - $startdate; $final=round($delta/3600);
View Replies !
Date() Function, Add A Couple Of Hours To It
The default timestamp that date() uses is the current time of the server which is processing the PHP document. So I wonder if I can add a coupla hours to this time? Say I need these 2 lines on my page: Here it is 1:00 pm, November 25, 2005 ------ date('g:i a, F j, Y'); There it is 4:00 pm, November 25, 2005 ----- date('g:i a, F j, Y', ???)
View Replies !
Find The Days, Hours, Minutes And Seconds?
I am making a function the will determine the amout of days, hours, minutes and seconds that are in a certian amout of seconds. For example: $all_seconds = 11405; I want to have this returned: $days = 0; $hours = 3; $min = 10; $sec = 5;
View Replies !
Time In Hours-Minutes-Seconds (accumulated)
Time in Hours-Minutes-Seconds (accumulated) How do I do this? I have minutes: $minutes_online = intval((time() - strtotime($data[$i]['dLastLogon']))/60); Ex: $minutes_online = 8758; How do I show this in Hour:Minute:Second - 10:32:22
View Replies !
Carry Out Function Every 24 Hours, Without Cron Jobs??
I'm trying to write a script which gets a random number every day, or 24 hours. I'm sure that the only way of doing this is using cron jobs, but I've checked with my host and they don't allow cron jobs Is there any other possible way of getting a script to activate every 24 hours?
View Replies !
|