CrazeD Posted July 17, 2007 Share Posted July 17, 2007 I have my date in MySQL, but I need to retrieve it. I'm making some forums, I need it to say when the post was submitted....which I can INSERT it, just can't get it back. It keeps putting the current date for all the posts, not the date in which they were entered. $date_entered = time ($post_row['date_entered']); $timestamp = date ('D M j, Y h:i A', $date_entered); $post_row refers to my SELECT query, where it gets the date in the MySQL table. This code here just outputs the current date/time, not what's in the database. Can anyone help? Thanks. Link to comment https://forums.phpfreaks.com/topic/60391-i-need-help-retrieving-dates-from-mysql/ Share on other sites More sharing options...
jbrill Posted July 17, 2007 Share Posted July 17, 2007 can't you just run a new query? $post_id = $_GET['post_id']; "SELECT date_entered FROM table WHERE id='$post_id'" then echo date_entered Link to comment https://forums.phpfreaks.com/topic/60391-i-need-help-retrieving-dates-from-mysql/#findComment-300428 Share on other sites More sharing options...
akitchin Posted July 17, 2007 Share Posted July 17, 2007 if you just want a formatted version of the date, you can grab that directly through MySQL using the DATE_FORMAT() function. see the MySQL manual's entry on functions and operators (section 13ish i think). there are a slew of built-in functions that are very handy when pulling info from the database. as for when you're inserting it, are you using PHP to insert the value, or are you using MySQL's NOW() function? Link to comment https://forums.phpfreaks.com/topic/60391-i-need-help-retrieving-dates-from-mysql/#findComment-300434 Share on other sites More sharing options...
CrazeD Posted July 17, 2007 Author Share Posted July 17, 2007 I used NOW(). I'll try what you said and see what I get. Link to comment https://forums.phpfreaks.com/topic/60391-i-need-help-retrieving-dates-from-mysql/#findComment-300624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.