php / mysql create

Associate
Joined
29 Jul 2005
Posts
445
Location
Matlock
hey there, just started messing about with php / mysql

i've set up a nice little login script however i can't seem to create the tbl to store the users info, so far i have:

PHP:
<?php

   include 'library/config.php';
   include 'library/opendb.php';

mysql_query("CREATE TABLE tbl_user(
 user_id INT NOT NULL AUTO_INCREMENT, 
 PRIMARY KEY(user_id),
 user_name VARCHAR(30), 
 user_password VARCHAR(30)")
 or die(mysql_error());  

echo "Table Created";

include 'library/closedb.php';

?>

i then go to http://............/createusertable.php but get this 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 '' at line 5

any ideas??

thanks
 
you're missing one closing bracket....

PHP:
<?php

   include 'library/config.php';
   include 'library/opendb.php';

mysql_query("CREATE TABLE tbl_user(
 user_id INT NOT NULL AUTO_INCREMENT, 
 PRIMARY KEY(user_id),
 user_name VARCHAR(30), 
 user_password VARCHAR(30))")
 or die(mysql_error());  

echo "Table Created";

include 'library/closedb.php';

?>

just at the end of user_password VARCHAR(30)
 
Back
Top Bottom