(1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNSIGNED AUTO_INCREMENT, nomCognoms varchar(60) not NULL unique_key, adreca va' at line 2
$sql = "CREATE TABLE aligxager
(id INT(11) not NULL UNSIGNED AUTO_INCREMENT,
nomCognoms varchar(60) not NULL unique_key,
adreca varchar(50) not NULL,
ciutat varchar(50) not NULL,
cp varchar(50) not NULL,
comarcaPais varchar(50) not NULL,
dataNaix varchar(20) not NULL,
adrecaE varchar(255) not NULL,
periode INT(1) not NULL,
dataPagament INT(1) not NULL,
esMembre INT(1) not NULL,
volBanquet INT(1) not NULL,
volPlanetari INT(1) not NULL,
volcotxePlanetari INT(1) not NULL,
TotalPagar INT(11) not NULL,
tipusAllotjament INT(1) not NULL,
modePagament INT(1) not NULL,
comentaris blob,
anyCongres int (11),
donaco varchar (10),
PRIMARY KEY (id))";
It is a syntax error, it seems to me that it may be because of this (unique_key):
It would be like this:
and if not, try removing the UNSIGNED as it is auto_increment, that statement is not necessary since mysql starts from 1:
THIS WORKS (I have elaborated and tested it on my localhost)
You can do it with 2 queries. First we create the table:
And later we add Unique key to the nomCognoms:
ALL IN ONE:
Try this: