Jump to content

Tag system: a tale of two tables


Lambneck

Recommended Posts

What I'm working on is a tag system for a blog. When someone clicks on a tag link they should be taken to a page listing all entries related to that tag.

 

However the tag data is in one table and the blog entries data is in another table. So the 'tag' value is passed in the URL it is specifying which row in the "tags table" should be referenced. Within this row (in the tags table) is a column called blog_entry_id which contains the id number of the corresponding bog entry data in the other table.

 

My question is how to write the select query in order to accomplish this? :confused:

 

$sql="SELECT * FROM blog_table WHERE tag_table=$_GET['id'] AND blog_entry_id=actual_blog_id"; //?

 

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.