link two tables
I am new to this and have a little issue I cannot quite work out.
I have two tables
Table name: gallery
gallery_id, title, description, featured, created
Table name: gallery_images
image_id, gallery_id, image, caption, image_order
I want to list the contents of the gallery table and call the images related to each field from the gallery images table.
This displays the title of each entry in the database and only one image associated with it.
$gallery = new DataConn; // pre set to connect to db
$gallery->query("SELECT gallery.gallery_id, title, description, featured, image FROM gallery LEFT JOIN gallery_images ON gallery_images.gallery_id = gallery.gallery_id AND image_order = 0");
while ($rs_gallery = mysql_fetch_array($gallery->result))
How can I loop through the images held in gallery_images and display them under each title?
Any help would be great thank you,
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread