user4327165
user4327165

Reputation:

How to add post from one table to category in another table?

I have two different tables in my database. One called 'video' and another one is 'meta'. In the 'video' table, I have 'title' & 'content'. On my 'meta' table, I have 'cid'. So what I am trying to do is, I want to assign each 'content' (from video) to 'cid' (from meta). Please let me know if you need any further explanation of my question. Thanks in advance!

Upvotes: 1

Views: 48

Answers (1)

Ty H.
Ty H.

Reputation: 953

Your Video table must have a Primary Key column, it could be called 'cid', or 'VideoID', or anything. That key field must be Unique and should be auto-incrementing, so that every new row in Video is automatically assigned a 'cid'. Then you can store that 'cid' in the Meta table and you have a relationship. You should also setup a Foreign Key relationship so that the Meta table knows that a 'cid' must match a Primary Key in the Video table.

This relationship will alloy many Meta's to relate to one Video.

Upvotes: 1

Related Questions