1 kraemers Feb 14, 2005 05:20
Is there a way to have a post auomatically updated as far as the date and time is concerned? I want a post to stay updated with current date and time evertime I refresh the post page (this post would always be on top of other posts). So it would say Posted 2/2/05 6:23:36 pm, and then I would refresh the current page a minute later and it would say Posted 2/2/05 6:24:36 pm and so on.
3 kraemers Feb 14, 2005 21:59
I want to be able to do something like this, but I know it's the wrong code format (post_issue_date and post_mod_date are both date formats).
<?php // Connecting, selecting database $link = mysql_connect('localhost', 'my_blog', 'blog') or die('Could not connect: ' . mysql_error()); echo 'Connected successfully'; mysql_select_db('my_blog') or die('Could not select database'); // Performing SQL query $query = 'UPDATE `evo_posts` SET `post_issue_date` = ''echo date("Y-m-d H:i:s");'', `post_mod_date` = ''echo date("Y-m-d H:i:s");'' WHERE `ID` = ''52'' LIMIT 1'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Closing connection mysql_close($link); ?>
the time you want to show is not the time the post is 'posted' but the time on your computer.
So why not show the computer time ?