Grab 1 image from 2nd table per listing

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

Grab 1 image from 2nd table per listing

Post by Jim_Bo »

Hi,

I have 2 tables.. one for listings and the other for photos.. I havnt been able to display one image per listing trying a query within a loop and also a table join.. Both options are briging back the same photo for all listings, even listings with no photos..

the link between the tables is "listingid"

How can I acheive this?


Thanks
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Grab 1 image from 2nd table per listing

Post by Eric! »

You'll have to show us some code and your database structures. Is there a common key between the two tables? How are you linking the right photo to the right listing?
Post Reply