Jump to content

Linking Databases


stublackett

Recommended Posts

Hi,

 

I've made 3 tables

 

Tables are setup like

 

User Table

UserID username fullname email password level address1 address2 city postcode userlevel

 

Ideas Table

IdeasID title description category image

 

User_Ideas

UserID IdeasID

 

I'm using PHPMyAdmin

and what I'd like to do is create a relationship between the User_Ideas table and the Users and Ideas table using the Primary Keys as indexes (Note there are underlined)

 

How do I link the tables together, So that when say an Idea is added to the ideas' table, It then links to the User_Ideas table and inserts the values of the relationship

 

Any ideas on :

a) How to do this in PHPMyAdmin !?

OR

b) How to do this in Pure MySQL Code?

 

Thanks

 

 

 

 

 

 

Link to comment
Share on other sites

I don't know what you mean by "inserts the values of the relationship".

 

Ok, A user signs up to the sight for instance

 

He is then given a UNIQUE UserID of 1 - For Example Purposes

He submits an Idea which has the IdeasID of 1 also

 

So the user_ideas table contains the

UserID = 1

IdeasID = 1

 

and this will then make sure that the Idea submitted by the user is Unique to them and paired to them

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.