ebchost Posted June 21, 2011 Share Posted June 21, 2011 i try tu insert current date and time, but, value inserted in table is 0000-00-00 00:00:00 all the time (wth no value) [syntax=php]$sql = "INSERT INTO `rss_vesti` SET `SAJT_ID` = '$rss_izvor_id', `NASLOV` = '$title1', `SLIKA` = '$image2', `SADRZAJ` = '$descritpion_trim1', `IZVOR` = '$link1', `DATUM` = 'CURDATE()'"; mysql_query($sql)or die(mysql_error());[/syntax] wer is the probelm? Link to comment https://forums.phpfreaks.com/topic/239959-date-time-current-value/ Share on other sites More sharing options...
ebchost Posted June 21, 2011 Author Share Posted June 21, 2011 $datum = date('Y-m-d H:m:s'); Link to comment https://forums.phpfreaks.com/topic/239959-date-time-current-value/#findComment-1232648 Share on other sites More sharing options...
PFMaBiSmAd Posted June 21, 2011 Share Posted June 21, 2011 The mysql CURDATE() function returns a string (they way you are using it), so it does not get enclosed by single-quotes inside the query. Enclosing it in single-quotes makes it a string, made up of the following characters - C, U, R, D, A, T, E, (, and ) Link to comment https://forums.phpfreaks.com/topic/239959-date-time-current-value/#findComment-1232743 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.