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
https://forums.phpfreaks.com/topic/92874-linking-databases/
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
https://forums.phpfreaks.com/topic/92874-linking-databases/#findComment-475740
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.