Jump to content

php not inserting data into mysql


Stealth549

Recommended Posts

Hello, getting back into php/mysql. Currently working on a project to store user infomation into a database to make stats later on.I get an error while trying to enter the infomation into the database and I cant see why it wont work, probably some small silly typo.you can see the error in action here

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 ''clients' (ip, countryName, countryCode, host, user_agent, date) VALUES('81.187.' at line 1
$sql = "INSERT INTO 'clients' (ip, countryName, countryCode, host, user_agent, date) VALUES('$cookie_ip', '$countryName', '$countryCode', '$host', '$user_agent', '$date')";				print_r($sql);		echo "<br />";		mysql_query($sql) or die(mysql_error());

Link to comment
Share on other sites

"clients" should be quoted with `, not with '.If you still get a syntax error, use the same kind of quotation around the column names.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...