plznty Posted September 26, 2009 Share Posted September 26, 2009 <?php $RSN = $_GET["n"]; $IP = $_SERVER['REMOTE_ADDR']; $TOPIC = $_GET["thread"]; echo "<title>FailScape Community // $TOPIC</title>"; // MySQL Connection mysql_connect("localhost", "webhostg_master", "pass") or die(mysql_error()); mysql_select_db("webhostg_IPtracker") or die(mysql_error()); mysql_query("INSERT INTO database (rsn, ip) VALUES('$RSN', '$IP' ) ") or die(mysql_error()); echo "$RSN - $TOPIC was not found on Failscape servers. Please type a correct URL."; ?> I get the error 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 'database (rsn, ip) VALUES('ryan', '11.11.148.85' )' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/175633-solved-mysql-php-error-help/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 26, 2009 Share Posted September 26, 2009 As you can probably imagine the word database (the start of the part of the query that was printed in the error message) probably has special meaning to a database query language. Ref: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You either need to use a different name for your table or you need to enclose database in back-ticks ` everywhere it gets used in a query. Quote Link to comment https://forums.phpfreaks.com/topic/175633-solved-mysql-php-error-help/#findComment-925487 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.