Ragazzi scusate, ho controllato la guida di HTML.it, ho consultato la guida ufficiale, ho cercato ovunque ma non arrivo a capo al problema.
C'è un'anima buona che mi aiuta a risolvere questo problema?
Devo relazionare due tabelle in modo tale che eliminando un record sulla prima mi elimini il corrispondente sulla seconda (utilizzando la funzione FOREIGN KEY), ma se popolo tutti i campi delle due tabelle tramite un unico form non mi si relazionanto.
Sapete dirmi cosa c'è di sbagliato in queste tabelle?
Codice PHP:
CREATE TABLE users (
id int(11) NOT NULL AUTO_INCREMENT,
nome varchar(20) NOT NULL,
cognome varchar(20) NOT NULL,
username varchar(20) NOT NULL,
email varchar(60) NOT NULL,
password varchar(50) NOT NULL,
key_control varchar(50) NOT NULL,
ver int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE profile (
id_profile int(11) NOT NULL AUTO_INCREMENT,
id_users int(11) default NULL,
INDEX par_ind (id_users),
nomedarte varchar(100) NOT NULL,
opz1 varchar(100) NOT NULL,
opz2 int(1) NOT NULL DEFAULT '0',
opz3 int(1) NOT NULL DEFAULT '0',
opz4 int(1) NOT NULL DEFAULT '0',
opz5 int(1) NOT NULL DEFAULT '0',
opz6 int(1) NOT NULL DEFAULT '0',
opz7 int(1) NOT NULL DEFAULT '0',
opz8 int(1) NOT NULL DEFAULT '0',
opz9 int(1) NOT NULL DEFAULT '0',
opz10 int(1) NOT NULL DEFAULT '0',
opz11 int(1) NOT NULL DEFAULT '0',
opz12 int(1) NOT NULL DEFAULT '0',
opz13 int(1) NOT NULL DEFAULT '0',
opz14 int(1) NOT NULL DEFAULT '0',
opz15 int(1) NOT NULL DEFAULT '0',
opz16 int(1) NOT NULL DEFAULT '0',
opz17 int(1) NOT NULL DEFAULT '0',
opz18 int(1) NOT NULL DEFAULT '0',
opz19 int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (id_profile),
FOREIGN KEY (id_users) REFERENCES users (id)
) ENGINE=InnoDB;
Grazie