I've a table 'photos' containing three fields.
photo_id, Restaurant name, image
1, Restaurant 1, restaurant 1 Image_1
2, Restaurant 1, restaurant 1 Image_2
3, Restaurant 1, restaurant 1 Image_3
4, Restaurant 2, restaurant 2 Image_1
5, Restaurant 2, restaurant 2 Image_2
6, Restaurant 2, restaurant 2 Image_3
7, Restaurant 3, restaurant 3 Image_1
8, Restaurant 3, restaurant 3 Image_2
basically it contains photos of restaurants.
Each row describe a photo. If a restaurant has multiple photos, it would have multiple rows.
Now i want to display a html table like this
Restaurant Name, Images
Restaurant 1, restaurant 1 Image_1,restaurant 1 Image_2,restaurant 1 Image_3
i.e a row containing restaurant name in one cell and ALL photos of that restaurant in single cell..
what i am doing is
Code: Select all
$query='select * from photos';
$res=mysql_query($query);
while($row=mysql_fetch_array($res)){
echo '<tr><td>'.$row['restaurant_name'].'</td><td>'.$row['image'].'</td></tr>';
}
echo '</table>';
restaurant name, first image.
restaurant name, second image
restaurant name, third image.
How to get all photos of a restaurant in a cell?.
Regards