Re: I need help Please....

From: Date: Thu, 13 Sep 2001 01:14:19 +0000
Subject: Re: I need help Please....
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-12390@lists.php.net to get a copy of this message
you know, i've stared at syntax too many times that the error was as simple as putting a space where it shouldn't be... or some other simple stuff. what i learned is to test the syntax by breaking it down to the simplest terms. like in your case, break it down so you are only defining one column in your table, without the attributes for them, or at least the simplest one. then just keep adding to it until you get that "A HA!" (which, btw, had my favorite one-hit wonder song of all times... :-)) momemnt where you see where the silly error was... kelvin wrote: > > Hello all, > > I tried to create a table which included primary key and a unique key. > But I got this error. > > You have an error in your SQL syntax near 'UNIQUE,hpassword VARCHAR(50),head > VARCHAR(50),body VARCHAR(50),ears VARCHAR(50),' at line 1 > > Can anyone help me please. > This is my code. -- Below > > <? $link=mysql_pconnect("hostname","Name","Password") or > die(mysql_error()); > mysql_select_db("DBname") or die(mysql_error()); > $query="create table Body (id int unsigned auto_increment NOT NULL PRIMARY > KEY,"; > $query.="husername VARCHAR(50) not null UNIQUE,"; > $query.="hpassword VARCHAR(50),"; > $query.="head VARCHAR(50),"; > $query.="body VARCHAR(50),"; > $query.="ears VARCHAR(50),"; > $query.="eyes VARCHAR(50),"; > $query.="hair VARCHAR(50),"; > $query.="mouth VARCHAR(50),"; > $query.="nose VARCHAR(50),"; > $query.="date date not null,"; > $query.="time time not null)"; > mysql_query($query) or die(mysql_error()); > ?> -- Leo G. Divinagracia III ldivinag@csuhayward.edu

« previous php.db (#12390) next »