A Database Error Occurred in CodeIgnitor

100 views
Skip to first unread message

Narong Cheng

unread,
Mar 10, 2013, 8:14:29 AM3/10/13
to codei...@googlegroups.com

I am run well my project(CodeIgniter Framework 2.02) with SQL server but after i back up it and setup new window and restore it. I got errors all when i connect to database. Everyone plz help me, This is my errors:

A Database Error Occurred

Error Number: 1452

 Cannot add or update a child row: a foreign key constraint fails (`user`.`tbl_users`, CONSTRAINT `tbl_users_ibfk_2` FOREIGN KEY (`k_production_id`) REFERENCES `tbl_productions` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)

INSERT INTO `tbl_users` (`name`, `email`, `password`, `sex`, `telephone`, `address`) 
 VALUES ('sok', 'exa...@gmail.com', '123', 'F', '012 123456', 'pp')

Filename: D:\wamp\www\music\system\database\DB_driver.php

Line Number: 330

Allan Freitas

unread,
Mar 11, 2013, 10:16:46 AM3/11/13
to codei...@googlegroups.com
FK violation, you arent insert some required fields by your database structure.

You have a field named "production_id" on users table, that is required by the FK.
and Its not on your insert below.
Reply all
Reply to author
Forward
0 new messages