Jump to content

Date function help?


DarrenReeder

Recommended Posts

Hello..

 

On my site i have made my own 'mini' forums and im trying to make them order propaly so i original used the date() function save save the date into the mysql database like..

 

date(y-m-d)

 

but that only saves the Year, month and day so it cant be orderd propaly...how can i make this save it so its Y-M-D, Hour,minute,Second ???

 

**P.S. im updated the original thread in the record everytime someone posts a reply and when the thread is made, and when i use the loop to display it all i make sure its order to the 'LastReply' DESC**

Link to comment
https://forums.phpfreaks.com/topic/184424-date-function-help/
Share on other sites

The query that you supplied simply updates the thread's views when somebody looks at the thread. My code is for when somebody creates a thread. Post your creation query and I will amend it accordingly.

 

Oh, and to sort by date AND time, on your select query after the WHILE clauses add:

 

ORDER BY datetime DESC // datetime being your field name for the date/time

 

EDIT:

 

$insert = mysql_query("UPDATE threads SET ReplayLast=NOW() WHERE ID='$threadid'") or die(mysql_error());

Link to comment
https://forums.phpfreaks.com/topic/184424-date-function-help/#findComment-973529
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.