ShoeLace1291 Posted May 26, 2007 Share Posted May 26, 2007 How do I update a DATETIME table row? What would the value for $datetime be? $query = mysql_query("INSERT INTO news(headline,message,posterID,datetime) values('$headline', '$message', '$posterid', '$datetime')") or die("Error: ".mysql_error()); Link to comment https://forums.phpfreaks.com/topic/53064-update-datetime-row/ Share on other sites More sharing options...
MadTechie Posted May 26, 2007 Share Posted May 26, 2007 Depends on the datatype try $datetime = now(); assuming you want the current date/time.. re-phrase the question Link to comment https://forums.phpfreaks.com/topic/53064-update-datetime-row/#findComment-262140 Share on other sites More sharing options...
taith Posted May 26, 2007 Share Posted May 26, 2007 or $datetime=time(); Link to comment https://forums.phpfreaks.com/topic/53064-update-datetime-row/#findComment-262141 Share on other sites More sharing options...
ShoeLace1291 Posted May 26, 2007 Author Share Posted May 26, 2007 Niether of those worked. now() just gave me an unkown function error and time() didn't update it at all. Link to comment https://forums.phpfreaks.com/topic/53064-update-datetime-row/#findComment-262143 Share on other sites More sharing options...
MadTechie Posted May 26, 2007 Share Posted May 26, 2007 OK.. so whats the field's datatype ? please look in my signature for how to ask a question! Link to comment https://forums.phpfreaks.com/topic/53064-update-datetime-row/#findComment-262144 Share on other sites More sharing options...
ShoeLace1291 Posted May 26, 2007 Author Share Posted May 26, 2007 The field data type is DATE. Link to comment https://forums.phpfreaks.com/topic/53064-update-datetime-row/#findComment-262146 Share on other sites More sharing options...
MadTechie Posted May 26, 2007 Share Posted May 26, 2007 atleast one of these should work!! CURDATE(); CURRENT_DATE(); NOW(); you may want to post your tests! Link to comment https://forums.phpfreaks.com/topic/53064-update-datetime-row/#findComment-262175 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.