On Wed, 12 Sep 2001 01:19, mkrisher wrote:
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),
supplierVARCHAR(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
Immediately after the mysql_db_query line, use mysql_error() to return
the mysql error message. I'll hazard a guess that it is because you
haven't assigned a default value to your autoincrement field.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
I'm as busy as a bee, Tom droned.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]