'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,
PRIMARY KEY(`patnote`))


Chris W

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)
$dbuser="smeduser";
$dbpassword="xxxxx";
$dbname="smed";
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)";
mysql_query($query);
mysql_close();
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 dennis

Hotmail. Get busy. _________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to