Hello, my English is not very good, but I'll try to explain what I need.
I have three tables in my database: SHOPS - CAR - PHOTOS
The CARS, PHOTOS tables have foreign keys with cascading deletes, ie when excluding a record in the table STORES also deletes the records of other tables.
The relationship is each store has several cars and each car has multiple pictures.
The database is working perfectly, but I want to use this with GC and I'm not getting.
The following images of tables and pages.
[attachment=1077:01-tabelas.jpg] [attachment=1078:02-lojas.jpg] [attachment=1079:03-carros.jpg] [attachment=1080:04-fotos.jpg]
The tables SQL
CREATE TABLE `lojas` ( `Id_lojas` int(11) NOT NULL AUTO_INCREMENT, `Nome` varchar(255) DEFAULT NULL, `Endereco` varchar(255) DEFAULT NULL, `Imagem` varchar(255) DEFAULT NULL, PRIMARY KEY (`Id_lojas`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
CREATE TABLE `carros` ( `Id_carros` int(11) NOT NULL AUTO_INCREMENT, `Nome` varchar(255) DEFAULT NULL, `Id_lojas` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`Id_carros`), KEY `fk_carros_loja` (`Id_lojas`), CONSTRAINT `fk_carros_loja` FOREIGN KEY (`Id_lojas`) REFERENCES `lojas` (`Id_lojas`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
CREATE TABLE `fotos` ( `Id_fotos` int(11) NOT NULL AUTO_INCREMENT, `Imagem` varchar(255) DEFAULT NULL, `Id_carros` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`Id_fotos`), KEY `fk_fotos_carros` (`Id_carros`), CONSTRAINT `fk_fotos_carros` FOREIGN KEY (`Id_carros`) REFERENCES `carros` (`Id_carros`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1;
I need to add cars only in the store 1:
dashboard / shops / 1 or dashboard/shops/add/1
[attachment=1081:05-lojas-add.jpg]
One must add photos only in the car 3 store 3:
dashboard / cars / 3 or dashboard/cars/add/3
[attachment=1082:06-carros-add.jpg]
I have another system that did in PHPMaker that work perfectly but I want to use with GC, is it possible?