Welcome Guest, Not a member yet? Register   Sign In
saving with foreign key....

Hi guys!

I'm new of CodeIgniter.
I have a problem with savign a new Objetc with reference key...
$anag = new Anagrafica();
            $user = new User();
            $user->login = 'Adelaide';
            $user->password = 'adelaide43';
            $user->email = '[email protected]';

this is the error...

A Database Error Occurred
Error Number: 1452

Cannot add or update a child row: a foreign key constraint fails (`minijob`.`an_user`, CONSTRAINT `an_user_ibfk_1` FOREIGN KEY (`anagrafica_id`) REFERENCES `an_agrafica` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE)

INSERT INTO `an_user` (`login`, `password`, `email`) VALUES ('Adelaide', 'adelaide43', '[email protected]')

Filename: /Applications/MAMP/htdocs/minijob/libraries/Datamapper.php

Line Number: 1713

Theme © iAndrew 2016 - Forum software by © MyBB