mysql_db_query create table error
| From: | mkrisher | Date: | Tue, 11 Sep 2001 15:49:26 +0000 |
| Subject: | mysql_db_query create table error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66938@lists.php.net to get a copy of this message | ||
All,
I am trying to create a table in a mySQL database, seems like it would be
easy enough, but for some reason it is not working, below is the code:
// Query to create table and columns
$sql = "CREATE TABLE 'products' (
id INTEGER UNSIGNED NOT NULL AUTOINCREMENT PRIMARY KEY,
description TEXT,
jewelery-type VARCHAR(255),
catalog-number VARCHAR(255),
price VARCHAR(255),
stone-type VARCHAR(255),
stone-color VARCHAR(255),
stone-cut VARCHAR(255),
stone-clarity VARCHAR(255),
stone-carat VARCHAR(255),
supplier VARCHAR(255),
metal-type VARCHAR(255),
width VARCHAR(255),
length VARCHAR(255),
setting VARCHAR(255)
)";
// create connection
// substitute hostname, username and password
$connection = mysql_connect("mkrisher", "mkrisher", "") or die
("Couldn't
connect to server.");
// select database
// substitute database name
$db = mysql_select_db("richmondjewelers") or die ("Couldn't open
database.");
// execute SQL query and get result
$sql_result = mysql_db_query($db, $sql) or die ("Couldn't execute query!");
I always get the "Couldn't execute query" error, is there something else
that I should be doing, watching for permission issues or something?
Thanks in advance,
__ Michael Krisher
__ http://www.sectiongroup.com