Jump to content


Carlos Cortes

Member Since 30 Jan 2013
Offline Last Active Feb 07 2013 11:31 PM
-----

Topics I've Started

Getting problem with relation_n_n

30 January 2013 - 11:52 PM

Hi,

I'm starting to use the GC plugin for CI and it is awesome!, but now im getting some error when i try to add a new registry to the database but not when i edit one.
This is the error:

<p>Error Number: 1452</p><p>Cannot add or update a child row: a foreign key constraint fails (`josuedor_bd_investigaciones`.`nombre_grupo_has_usuarios`, CONSTRAINT `fk_nombre_grupo_has_invesstigadores_invesstigadores1` FOREIGN KEY (`usuarios_idUsuario`) REFERENCES `usuarios` (`idUsuari)</p><p>INSERT INTO `nombre_grupo_has_usuarios` (`usuarios_idUsuario`, `nombre_grupo_idgrupo`) VALUES (0, '111')</p><p>Filename: C:\xampp\htdocs\practicas\proyecto-practicas\system\database\DB_driver.php</p><p>Line Number: 330</p></div>


And this is the code of the relation:

$crud->set_relation_n_n('grupo','nombre_grupo_has_usuarios','nombre_grupo','usuarios_idUsuario','nombre_grupo_idgrupo','nombre_g');

Just in case, the fields:

$crud->fields('idUsuario','nombre','apellido','direccion','fijo','celular','email','grupo');

Thank you for your help, i had been trying this all day but omg. :unsure: