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()); Quote 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 Quote 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(); Quote 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. Quote 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! Quote 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. Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/53064-update-datetime-row/#findComment-262175 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.