-- Table `mydb`.`table1` CREATE TABLE IF NOT EXISTS `mydb`.`table1` ( `ID_table1` INT NOT NULL AUTO_INCREMENT, `PARENT` VARCHAR(45) NULL, PRIMARY KEY (`ID_table1`)) ENGINE = InnoDB; -- Table `mydb`.`table2` CREATE TABLE IF NOT EXISTS `mydb`.`table2` ( `ID_table2` INT NOT NULL AUTO_INCREMENT, `ID_table1` INT NOT NULL, `CHILD` VARCHAR(45) NULL, PRIMARY KEY (`ID_table2`), INDEX `table2 [X] table11_idx` (`ID_table1` ASC), CONSTRAINT `table2 [X] table11` FOREIGN KEY (`ID_table1`) REFERENCES `mydb`.`table1` (`ID_table1`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- Table `mydb`.`table3` CREATE TABLE IF NOT EXISTS `mydb`.`table3` ( `ID_table3` INT NOT NULL AUTO_INCREMENT, `ID_table2` INT NOT NULL, `BABY` VARCHAR(45) NULL, PRIMARY KEY (`ID_table3`), INDEX `table3 [X] table21_idx` (`ID_table2` ASC), CONSTRAINT `table3 [X] table21` FOREIGN KEY (`ID_table2`) REFERENCES `mydb`.`table2` (`ID_table2`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB;
My controller goes like this:
public function Relations() { $crud = new grocery_CRUD(); $crud->set_table('table1'); $crud->set_relation('id_table2','table2','CHILD'); $crud->set_relation('id_table3','table3','BABY'); $crud->columns('PARENT','CHILD','BABY'); $output = $crud->render(); $this->_example_output($output); }
- Values for Parents and Children are CRUD on a different controllers respectively.
- Values for Babies will be CRUD on this controller
I tried different random shots but nothing worked, therefore I don't have even partial result.
Your help is highly appreciated in advance.