Jump to content

[SOLVED] Querying two tables


padams

Recommended Posts

Not sure how to approach this. I am trying to display results from two tables, and the data I want from the second table is dependent on what comes out from the first one.

 

I have a webpage that should display details and a thumbnail image for videos I'm selling, but as some videos have more than one thumbnail I have separated them into their own table. Each image has a videoID that links it back to a particular video from the video table. VideoID is the primary key for the videos table.

 

Videos are organised by categories, so when I go to a particular category, all videos from that will be displayed. However, my query is going to the video table and selecting all those videos matching the selected category. This means that I can't query the images table at the same time as I don't initially know which videos will be displayed. How would I go about doing this?

 

Code:

$query="SELECT title, blurb FROM videos WHERE cat_id='".$catID."'";

 

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.