Welcome Guest, Not a member yet? Register   Sign In
Getting data to save with foreign key
#2

(This post was last modified: 11-26-2014, 03:47 AM by slax0r.)

A parent-child relation in the same table must be NULL-able.
So, set your parent column to allow NULL.

Or if you wish to keep it at NOT NULL, you have to create a menu item with ID 0, that will never be shown in the web, and set your parent column to default value 0. Although the first method would be prefered I suppose.

Edit: why nullable? because the top level item can not have a parent.
Reply


Messages In This Thread
RE: Getting data to save with foreign key - by slax0r - 11-26-2014, 03:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB