Jump to content

foreign key in php admin


dubfoundry

Recommended Posts

Im currently building an app where user can customize an item upload a photo register and login to an account...so far all those scripts work great..

 

Now i need to have all the cust info pulled from multiple tables using an id reference so it can be displayed on the member area page. (whats the php/mysql script for this by the way?)

 

They are 3 tables in the database user,products and prd_order... in the user table there is a id(primaryKey) field and the prd_order table have an userid(set as an index) field in it.... I need both to be linked so that a new user auto links to his product choice in the prd_order table.

 

So i converted both tables to InnoDB and attempted to link both via the relational view panel

i got this error--

 

 

Error

 

SQL query:

 

ALTER TABLE `prd_order` ADD FOREIGN KEY ( `user_id` ) REFERENCES `imagecon`.`user` (

`id`

)

 

MySQL said: Documentation

#1216 - Cannot add or update a child row: a foreign key constraint fails

 

so im stuck..whats the work around....

 

 

 

Is it possible to reffer to and link both fields with out a foreign key. can you pull from multiple tables without using a foreign key?

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.