Having trouble with this SQL query

From: Date: Mon, 23 Jun 2003 15:56:32 +0000
Subject: Having trouble with this SQL query
Groups: php.db 
Request: Send a blank email to php-db+get-28812@lists.php.net to get a copy of this message
Hi to all: First of all, I'm a newbie to PHP and MYSQL and started working on a create table query in PHP to execute on MYSQL. Can someone take a quick look at the following code to see if there are any problems? Can you also advise some tips on debugging? Thank you in advance for your assistance. Take care, Chris McCourt PHP code: HTML> <HEAD> <TITLE>Creating a Database</TITLE> <BODY> <?php //Set the variables for the database access: $Host = "localhost"; $User = "root"; $Password = ""; $Link = mysql_connect($Host, $User, $Password) or die("Could not connect: " . mysql_error()); mysql_select_db("dive_store") or die("could not select database"); //Execute query to create User table $sql ="CREATE TABLE User( ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Store_ID Smallint(3), User_Name VARCHAR(15), Password VARCHAR(15), Address VARCHAR(50), State_ID Smallint (3), Postal_Code VARCHAR(10), Phone VARCHAR(20), E_mail VARCHAR(30), Cert_Org VARCHAR(25), Cert_DATE DATE, Cert_Level_ID Smallint(3) UNSIGNED NOT NULL, Emergency_Contact_Name VARCHAR(30), Emergency_Contact_Phone VARCHAR(30))"; //Run the above query $Result = mysql_query($sql); if ($Result){ echo("Table Created successfully"); }else{ echo("error when creating table"); } mysql_close($Link); ?> </BODY> </HEAD> </HTML>

« previous php.db (#28812) next »