PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Some how I need to get 1 group (Weddings) then cycle through the image names in that group then once that is done i need to go to the next group (5points) and display the 2 images in that div and so on. Weddings -> 2 images, 5points -> 2 images and Misc -> 2 images. It is putting each image in a separate div. The Wedding, 5points and Misc has 2 images each I am getting 6 divs with 1 image in each I should have 3 divs (wedding, 5points and misc) with 2 images displayed in each of the 3 divs. Hopefully I have explained a little better. This is driving me up the wall XD. Thanks all.
$pgroup = $Sys->db->query("SELECT dj_photo_group.photo_group, dj_photo.name, dj_photo.img_group FROM dj_photo_group, dj_photo WHERE dj_photo_group.photo_group = dj_photo.img_group ORDER BY dj_photo.img_group DESC");
$photo_group = ''; // initialize to no group
while($photo = $pgroup->fetch_object()) {
if ($photo->photo_group != $photo_group) { // the group has changed
if ($photo_group != '') { // not 1st time through loop
echo '</div>';
}
echo '<div class="photo_head">' . ucfirst($photo->photo_group) . '</div>';
echo '<div class="photo_sub">';
$photo_group = $photo->photo_group; // set to current group
}
echo '<img src="photogallery/' . $photo->photo_group . '/' . $photo->name . '" />';
}
echo '</div>';