'unsigned' is part of your data type which must be before the 'not
null' Your closing ) needs to be at the very end. There is no reason t
have the unique id since the primary key is unique.
First you need the column name 'patid' then the data type 'INT UNSIGNED'
then the other column options 'NOT NULL'
You should really use the back tick quotes around your column and table
names. The (9) after int is of no use in a php application since you
will have to do all your output formating in your php code. I have
changed the query to use upper case letters as that is the standard way
queries are written.
CREATE TABLE `patnotes` (
`patid` INT UNSIGNED NOT NULL,
`patnote` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`parentid` INT UNSIGNED NOT NULL ,
`appuserid` VARCHAR(40) NOT NULL,
`subject` VARCHAR(100) NOT NULL,
`body` LONGTEXT NOT NULL,
dennis skinner wrote:
> Hello I am a new mysql user. Can anyone tell me why this does not create a table?
> < ?php (the spaces before the question mark are not in the code)
> mysql_connect(localhost, $dbuser, $dbpassword);
> mysql_select_db($dbname) or die("unable to select database");
> $query="create table patnotes(patid int(9) not null unsigned, patnote int(6) not null
> unsigned auto_increment,
> parentid int not null unsigned, appuserid varchar(40) not null, subject varchar(100)
> not null,
> body longtext not null),
> primary key(patnote),
> unique id(patnote)";
> then the closing question mark and carat on this line this does not
> build a file and I am wondering what syntax I am missing here thanks
> Hotmail. Get busy.
> The New Busy is not the old busy. Search, chat and e-mail from your inbox.