Jump to content

[SOLVED] Why wont it create the table?


paulman888888

Recommended Posts

<?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

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)");

 

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

 

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.