Jump to content

double-worded column name problem


gsquare567

Recommended Posts

Can't have a space in a column name...change it to an underscore instead. Can't use single quotes around column names...can use backtick marks. Examples:

 

$sql = "UPDATE AuthDB SET `Last_Login` = '$find_time' WHERE `Username` = '$find_user'";

mysql_query($sql);

 

or

 

mysql_query("UPDATE AuthDB SET `Last_Login` = '" . $find_time . "' WHERE `Username` = '" . $find_user . "'");

 

 

It's best if last_login column is a datetime type and hence not have this formatting: Sunday, April 29th, 2007 at 8:28:13 AM

 

but rather: 2007-04-29 08:28:13

 

With the column being a datetime type, you can then choose to display it any way you want using the DATE_FORMAT() function. It shouldn't be saved in the format you show in case you wish to do date calculations using many of the build in date/time functions in MySQL.

 

hth

 

 

 

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.