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
https://forums.phpfreaks.com/topic/107263-solved-querying-two-tables/
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.