yusufhermanto Posted May 26, 2007 Share Posted May 26, 2007 can anybody tell me, how to save Date or time to the database. i always found error for this data. thanks, Quote Link to comment https://forums.phpfreaks.com/topic/53057-saving-datetime-to-mysql-database/ Share on other sites More sharing options...
taith Posted May 26, 2007 Share Posted May 26, 2007 just in your database, make either a text field, and fill it with a time(), or make a timestamp field Quote Link to comment https://forums.phpfreaks.com/topic/53057-saving-datetime-to-mysql-database/#findComment-262106 Share on other sites More sharing options...
yusufhermanto Posted May 26, 2007 Author Share Posted May 26, 2007 just in your database, make either a text field, and fill it with a time(), or make a timestamp field this my code: mysql_query("delete from pr where no_pr='".$nopesanan."'"); $s="insert into pr (no_pr,tgl_pr,kd_cust) values('".$nopesanan."', '".Time()."','".$cbocust."')"; mysql_query($s) or die(mysql_error()); this code can not save date for tgl_pr field Quote Link to comment https://forums.phpfreaks.com/topic/53057-saving-datetime-to-mysql-database/#findComment-262110 Share on other sites More sharing options...
taith Posted May 26, 2007 Share Posted May 26, 2007 what type of field is tgl_pr? $time=time(); mysql_query("insert into pr (no_pr,tgl_pr,kd_cust) values('$nopesanan', '$time','$cbocust')") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/53057-saving-datetime-to-mysql-database/#findComment-262113 Share on other sites More sharing options...
yusufhermanto Posted May 26, 2007 Author Share Posted May 26, 2007 what type of field is tgl_pr? $time=time(); mysql_query("insert into pr (no_pr,tgl_pr,kd_cust) values('$nopesanan', '$time','$cbocust')") or die(mysql_error()); tgl_pr type is dateTime Quote Link to comment https://forums.phpfreaks.com/topic/53057-saving-datetime-to-mysql-database/#findComment-262114 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.