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, 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 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 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()); 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 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
Archived
This topic is now archived and is closed to further replies.