Jump to content

Insert Server Date / Time into Database


JSHINER

Recommended Posts

Hello,

 

I currently have the following to insert a variable into a database:

 

$zip = $db->escape($_POST['zip']);

$db->query("INSERT INTO zip SET zips = '$zip'");

 

I would like to also add the date & time the submission was made.

 

Any help would be much appreciated.

 

 

Thanks !

Link to comment
https://forums.phpfreaks.com/topic/41282-insert-server-date-time-into-database/
Share on other sites

I get the following error:

 

Notice: Error in database query. Query was [iNSERT INTO zip SET zips = '01845' date_and_time=5/3/2007 - 10:09] and the error returned was [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'date_and_time="5/3/2007 - 10:09"' at line 1] in /home/daily125/public_html/php/Statsdb.php on line 141

 

 

Any ideas ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.