Hi everyone,

I've started a thread in the databases & mysql forum:

http://www.sitepoint.com/forums/show...eparate-tables

I am using a "lookup table" which means the same ID might appear multiple times in the table. Now the problem is that the data I'm returning loops out multiple times because of that ID.


This is the structure of the query. If the hotels_features table has the same hotel id appearing 5 times, the rooms will loop out 5 times as well.

Code:
$q = "SELECT column names
FROM hotels AS h INNER JOIN
rooms AS r ON r.hotel_id=h.hotel_id INNER JOIN
hotels_features AS hf ON hf.hotel_id = h.hotel_id INNER JOIN
features AS f ON f.features_id = hf.features_id
...WHERE category = '$category'";

Perhaps someone will know where the problem lies.


Thank you in advance.