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
Share on other sites

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

 

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.