My query look like this at the moment:
$result = mysql_query("SELECT * FROM promo JOIN items ON promo.id = items.promo_id WHERE promo.id='$promo_id'") or die('Error : ' . mysql_error());
while($row = mysql_fetch_array($result))
{
echo "<p>".$row['title']."</p>";
echo "<p>".$row['description']."</p>";
echo "<p>".$row['filename']."</p>";
}
I'd like to end up with the following:
Title of Promo 1
This is Promo 1 Description, isn't it great?!
filename_1.jpg
filename_2.jpg and however many files are linked to this promo listed...
However, based on the query above I get:
This is Promo 1 Description, isn't it great?!
filename_1.jpg
This is Promo 1 Description, isn't it great?!
filename_2.jpg
So it repeats (I can sort of see why) and doesn't pull in the 'title' of the promo at all! Can anyone recommend whether the problem is with my JOIN or my PHP? Many thanks for your help :)