problem using Now() in insert staetment
Hi all could any one tell me what is wrong with this sql statment it keeps giving error after i try to use Now function(No record entered).
Fatal error: Call to undefined function: now() in /date2.php on line 49
PHP Code:
mysql_query("INSERT INTO visitor VALUES('$ID','$HTTP_X_FORWARDED_FOR',[B]'". NOW() ."'[/B],'$countryName','$country')");
also i tried this and did not insert any records:
PHP Code:
mysql_query("INSERT INTO visitor VALUES('$ID','$HTTP_X_FORWARDED_FOR',[B]Now(),[/B]'$countryName','$country')");
My intention is to record and output visitor information acording to date and time . I hope some one help me what i am doing wrong here .THanks
PHP Code:
SELECT * FROM visitor ORDER BY date DESC
and date is stored in this format:
PHP Code:
date datetime NOT NULL default '0000-00-00 00:00:00',
Re: problem using Now() in insert staetment
now() is a SQL function, not a PHP one. Put it inside the quotes for the query.
Re: problem using Now() in insert staetment
There's a whole bunch of MySql functions you can use to get the current date as well:
http://dev.mysql.com/doc/refman/5.0/...functions.html
Re: problem using Now() in insert staetment