il manuale dice :
codice:
Cannot create table. If the error message string refers to errno 150, table creation failed because a foreign key constraint was not correctly formed.
il che vuol dire che una delle due chiavi esterne che ho dichiarato non va bene, ma ho controllato e mi sembra tutto ok...
le tabelle a cui faccio riferimento sono(le ho create prima di questa tabella con successo):
Codice PHP:
$tabelle ="CREATE TABLE utenti (";
$tabelle .=" nickname varchar(30) NOT NULL, ";
$tabelle .=" password varchar(30) NOT NULL, ";
$tabelle .=" email varchar(30) NOT NULL, ";
$tabelle .=" homepage varchar(30),";
$tabelle .=" firma varchar(20),";
$tabelle .=" power int(2) NOT NULL,";
$tabelle .=" citta varchar(20),";
$tabelle .=" interessi text,";
$tabelle .=" compl date default'0000-00-00',";
$tabelle .=" messaggi int(2) NOT NULL default '1',";
$tabelle .=" remeber int(2) NOT NULL default '1',";
$tabelle .=" emailv int(2) NOT NULL,";
$tabelle .=" date datetime default '0000-00-00 00:00:00',";
$tabelle .=" PRIMARY KEY(nickname),";
$tabelle .=" INDEX(power), ";
$tabelle .=" FOREIGN KEY(power) REFERENCES powers(id_power)";
$tabelle .=" ON DELETE CASCADE";
$tabelle .=" ON UPDATE CASCADE";
$tabelle .=") TYPE=InnoDB;";
Codice PHP:
$tabelle = "CREATE TABLE gruppi ( ";
$tabelle .=" id_gruppo int(6) NOT NULL auto_increment,";
$tabelle .=" titolo varchar(30)NOT NULL ,";
$tabelle .=" PRIMARY KEY (id_gruppo)";
$tabelle .=") TYPE=InnoDB;";
non vi sembra pure a voi che non c'è nulla di sbagliato?