Stealth549 Posted June 22, 2011 Share Posted June 22, 2011 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 More sharing options...
Ingolme Posted June 22, 2011 Share Posted June 22, 2011 I believe you can only use the tilde character for table names:INSERT INTO `clients`Also make sure you're escaping all the data. Link to comment Share on other sites More sharing options...
boen_robot Posted June 22, 2011 Share Posted June 22, 2011 "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 More sharing options...
Stealth549 Posted June 23, 2011 Author Share Posted June 23, 2011 Thanks, I thought it would be something like that Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.