date time value

Post here if you need help with SQL.
Post Reply
hostingebc
Posts: 28
Joined: Wed Jun 08, 2011 10:31 am

date time value

Post by hostingebc »

i try tu insert current date and time, but, value inserted in table is 0000-00-00 00:00:00 all the time
$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());
wer is the probelm?
hostingebc
Posts: 28
Joined: Wed Jun 08, 2011 10:31 am

Re: date time value

Post by hostingebc »

Solved

$datum = date('Y-m-d H:m:s');
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: date time value

Post by jacek »

you could also use the mysql NOW() function in place of the CURDATE() one you have above.
Image
Post Reply