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 Link to comment https://forums.phpfreaks.com/topic/108024-solved-why-wont-it-create-the-table/ 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) Link to comment https://forums.phpfreaks.com/topic/108024-solved-why-wont-it-create-the-table/#findComment-553655 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. Link to comment https://forums.phpfreaks.com/topic/108024-solved-why-wont-it-create-the-table/#findComment-553661 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); Link to comment https://forums.phpfreaks.com/topic/108024-solved-why-wont-it-create-the-table/#findComment-553668 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()); Link to comment https://forums.phpfreaks.com/topic/108024-solved-why-wont-it-create-the-table/#findComment-553673 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)"); Link to comment https://forums.phpfreaks.com/topic/108024-solved-why-wont-it-create-the-table/#findComment-553677 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 Link to comment https://forums.phpfreaks.com/topic/108024-solved-why-wont-it-create-the-table/#findComment-553683 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 Link to comment https://forums.phpfreaks.com/topic/108024-solved-why-wont-it-create-the-table/#findComment-553686 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.