Hello, 

With php, I want to create 2 tables, userid is a
primary key in TUser and a foreign key in TRight. I
want to create a default user during database
creation.


$sql1 = 'CREATE TABLE TUser(userid UNSIGNED INTEGER
PRIMARY KEY AUTOINCREMENT NOT NULL, username TEXT,
pseudo TEXT, password TEXT, email TEXT, lang TEXT)';

$sql2 = 'CREATE TABLE TRight(userid INTEGER,
usermanager BOOL, chef BOOL, writer BOOL, reader BOOL,
root BOOL)';

$sql3 = "INSERT INTO TUser(pseudo, password) VALUES
(\''$pseudo\'',\''$password\'')";

$sql4 = "INSERT INTO TRight(userid, usermanager, chef,
writer, reader, root)
VALUES(1,TRUE,TRUE,TRUE,TRUE,TRUE)";

(as 1 is the first autoinc unsigned.)

My question is : does 'unsigned' word recognized as a
constraint ?
if it is not, how can I write the sql constraint ?

userid UNSIGNED INTEGER PRIMARY KEY AUTOINCREMENT  NOT
NULL CONSTRAINT userid > 0 

BR,
David


      
_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to