ryanhowdy Posted May 27, 2008 Share Posted May 27, 2008 I am having problems with an addressbook table in my php/mysql application. The problem I am having is that users with mysql 5 seem to be getting an foreign key constraint fails error but no one else does. The table layout is as follows: id int(11) No user int(11) No 0 entered_by int(11) No 0 updated timestamp No CURRENT_TIMESTAMP address varchar(50) Yes NULL city varchar(50) Yes NULL state varchar(50) Yes NULL zip varchar(10) Yes NULL home varchar(20) Yes NULL work varchar(20) Yes NULL cell varchar(20) Yes NULL I wanted user and entered_by to both be foreign keys that point to table members.userid. It's been too long since my DB design classes, but I assume this isn't the right way to do this. The user field would be used for the user that the address belongs to and entered_by would be used to show what member entered that address, because I want to allow members to enter addresses for other members or non-members. Is there a better way to accomplish what I want? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/107441-addressbook-table-design/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.