Jump to content

Archived

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

sim0ng

linkup table

Recommended Posts

I'm in the process of recoding my cms and want to make catagories for content to be put under and would like a bit of help on how to create a linkup table.

I have got this so far for the main content

[code] mysql_query($strsql);
$strsql = "CREATE TABLE sim0ngportal_manuals_pages (id MEDIUMINT  UNSIGNED NOT NULL AUTO_INCREMENT,title VARCHAR(255), description MEDIUMTEXT , startpage CHAR(1), PRIMARY KEY (id));";[/code]

I will create a new table called "sim0ngportal_manuals_catagories" with just a field to insert catagory names, will probably be called "catagory_name" to keep things nice and simple.

Now, how do I then link the 2 together? do i need to create a forin key yo go to the other table? and how do I join it?  Have heard that I can use something like "INNER JOIN" but I'm not sure if thats correct or how exactly to use it.


Any help would be great
cheers :)

Share this post


Link to post
Share on other sites
You need a column in your content table called category_id or similar, and this will link to the category_id column in your new category table.

Regards
Rich

Share this post


Link to post
Share on other sites
right, okay, should I put it in like this??

[code],category_id int(11)[/code]

Share this post


Link to post
Share on other sites

×

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.