A little background. I'm building a auctioneer project (PHP/MySQL) where there is an unknown amount of images to be uploaded. The amount of images to be uploaded is to be defined by the user depending on amount of photos available. Uploading them online is no problem. I can see all the important info in the tables.
I have two relevant tables:
- Properties (Mish/Mash of columns)
- Images (Three columns: images_id, images_url, images_entry_id)
The images_entry_id refers to the unique properties.property_id. The problem lies in when I upload several images; There is an unique id, url and they have the same images_entry_id so I can reference them to the Properties table. So when I try an inner join I get several of the same outputs from the properties table depending on the amount of images. Hope this explains what I mean?
My Query:
$sql = "SELECT * FROM properties INNER JOIN images
ON properties.prop_id=images.images_entry_id ORDER BY properties.prop_id DESC";
So basically, if there are three images for one prop_id, I then get three outputs of the same output from the properties table! There! Any ideas? Is the database layout poor or is it just a simple query that has stared me in the face?