paulman888888 Posted May 30, 2008 Share Posted May 30, 2008 <?php mysql_connect("something.com", "ddddd", "sssssss") or die(mysql_error()); echo "Connected to MySQL<br />"; mysql_select_db("ddddd") or die(mysql_error()); echo "Connected to Database"; // Create a MySQL table in the selected database mysql_query("CREATE TABLE myscorev1( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), score INT), gameid INT)") or die(mysql_error()); echo "Table Created!"; echo "Install Completed"; ?> Why wont it make the table it comes up with this error, Connected to MySQL Connected to DatabaseYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' Gameid INT)' at line 5 Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted May 30, 2008 Share Posted May 30, 2008 because this is invalid SQL: CREATE TABLE myscorev1(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), score INT), gameid INT) Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted May 30, 2008 Author Share Posted May 30, 2008 sorry you lost me. Mine worked but then when i added gameid it diddn't work. Can you explain what i did wrong please. Quote Link to comment Share on other sites More sharing options...
peranha Posted May 30, 2008 Share Posted May 30, 2008 CREATE TABLE myscorev1(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), score INT), gameid INT) should be CREATE TABLE myscorev1(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), score INT, gameid INT); Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted May 30, 2008 Author Share Posted May 30, 2008 nope same error. mysql_query("CREATE TABLE myscorev1(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), score INT, gameid INT);") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
peranha Posted May 30, 2008 Share Posted May 30, 2008 mysql_query("CREATE TABLE myscorev1(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), score INT, gameid INT);") should be mysql_query("CREATE TABLE myscorev1(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), score INT, gameid INT)"); Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted May 30, 2008 Author Share Posted May 30, 2008 nope not working this is my full code what is wrong with it? <?php mysql_connect("ffffff.com", "dsf_sdf", "sdfsdfs") or die(mysql_error()); echo "Connected to MySQL<br />"; mysql_select_db("sdfsdfs") or die(mysql_error()); echo "Connected to Database"; // Create a MySQL table in the selected database mysql_query("CREATE TABLE myscorev1(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), score INT, gameid INT)") or die(mysql_error()); echo "Table Created!"; echo "Install Completed"; ?> please help Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted May 30, 2008 Author Share Posted May 30, 2008 i was opening the wrong file in my browser. Silly me. thankyou all the same Quote Link to comment 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.