|
-
Apr 21st, 2002, 07:28 PM
#1
Thread Starter
Stuck in the 80s
MySQL: CREATE TABLE
I'm having a problem with this:
PHP Code:
$db = mysql_connect("localhost", "user", "password");
mysql_select_db("database",$db);
$sql = "INSERT INTO cats (name,tablename) VALUES ('$name','$tablename')";
$sql2 = "CREATE TABLE $tablename (id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, name varchar(20), desc text, code text, PRIMARY KEY (id), UNIQUE id (id))";
$result = mysql_query($sql);
$result2 = mysql_query($sql2);
What's wrong with this code?
The INSERT INTO works, but the CREATE TABLE never creates the table??
-
Apr 21st, 2002, 07:31 PM
#2
Fanatic Member
desc is a reserved word, for the ORDER BY SQL statement. That may be causing your problem.
I would make your result2 the following to see what MySQL Error you get:
PHP Code:
result2 = mysql_query2($sql2) or die(mysql_error());
-Matt
-
Apr 21st, 2002, 07:49 PM
#3
Thread Starter
Stuck in the 80s
Originally posted by cpradio
desc is a reserved word, for the ORDER BY SQL statement. That may be causing your problem.
I would make your result2 the following to see what MySQL Error you get:
PHP Code:
result2 = mysql_query2($sql2) or die(mysql_error());
-Matt
and that it was. Thanks alot, Matt.
-
Apr 22nd, 2002, 08:31 PM
#4
Fanatic Member
yep i had that same problem the other day
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|