September 23rd, 1999, 09:42 AM
-
Is my code way off base? I can't get a table
created using php.
$sql = "CREATE TABLE '$table'(
partno CHAR(10) NOT NULL,
descript CHAR(60) NOT NULL,
cost DOUBLE(10,5) NOT NULL,
user CHAR(15) NOT NULL,
modelno CHAR(20) NOT NULL,
PRIMARY KEY(partno))";
$result = MYSQL_QUERY($sql) or die
("Invalid create");
September 23rd, 1999, 11:31 AM
-
I don't think you need the apostrophe's (') around the table name. That could be what's messing it up.
September 23rd, 1999, 01:24 PM
-
Also, instead of using "or die" which doesn't give you any info, on the next line do this:
if (!$result){
print mysql_error();
exit;
}
This exits gracefully while still giving you the info you need to determine what went wrong.
HTH
Rod