Welcome Guest, Not a member yet? Register   Sign In
Foreign Key constraint check
#3

[eluser]Jagar[/eluser]
Let me make an example:

Table
[Students]
student_name varchar
FK_program_id int

table [Program]
Program_id int
Program_name varchar

Now...

[Program]
Program_id Program_Name
1 Software Engineering
2 Networking
3 Web Design

[Student]
Student_name FK_program_id
John 1
James 3
Adam 2

Now right now if I go and delete the program_id 2, CI will throw an error and saying database error, and saying that you cannot delete that id because it's a foreign key of another table.

How can I detect such error, so I can tell the user instead of CI database error.

Thanks


Messages In This Thread
Foreign Key constraint check - by El Forum - 05-23-2009, 09:14 PM
Foreign Key constraint check - by El Forum - 05-24-2009, 12:14 AM
Foreign Key constraint check - by El Forum - 05-24-2009, 11:14 AM
Foreign Key constraint check - by El Forum - 05-24-2009, 11:19 AM
Foreign Key constraint check - by El Forum - 05-24-2009, 11:24 AM
Foreign Key constraint check - by El Forum - 05-24-2009, 11:31 AM
Foreign Key constraint check - by El Forum - 05-24-2009, 11:36 AM
Foreign Key constraint check - by El Forum - 05-25-2009, 09:41 AM
Foreign Key constraint check - by El Forum - 03-10-2010, 12:11 PM
Foreign Key constraint check - by El Forum - 03-10-2010, 12:14 PM
Foreign Key constraint check - by El Forum - 03-10-2010, 12:28 PM
Foreign Key constraint check - by El Forum - 03-10-2010, 01:43 PM
Foreign Key constraint check - by El Forum - 04-05-2011, 01:58 PM
Foreign Key constraint check - by El Forum - 04-05-2011, 11:34 PM
Foreign Key constraint check - by El Forum - 04-06-2011, 01:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB