HELP! Code not creating a table, does this look ok? How do you usually debug to find out what is not working in MySQL?
<?php
// Connect to the file above here
require "connect_to_mysql.php";
$sqlCommand = "CREATE TABLE products (
id INT(11) NOT NULL auto_increment,
product_name VARCHAR(255) NOT NULL,
price VARCHAR(64) NOT NULL,
details text NOT NULL,
category varchar(64) NOT NULL,
date_added date NOT NULL,
PRIMARY KEY(id),
UNIQUE KEY product_name(product_name),
)";
mysql_query($sqlCommand) or die(mysql_error());
?>
The last line doesn't need a comma ,
$sqlCommand = "CREATE TABLE products (
id INT(11) NOT NULL auto_increment,
product_name VARCHAR(255) NOT NULL,
price VARCHAR(64) NOT NULL,
details text NOT NULL,
category varchar(64) NOT NULL,
date_added date NOT NULL,
PRIMARY KEY(id),
UNIQUE KEY product_name(product_name)
)";
I tried out this code in phpMyAdmin first and found that error ^