What I'm trying to do is get the photo_id='.$pid.' of each photo for the link wrapped around them inside the foreach loop.
I tried $image['photo_id'] but that didn't work it just printed image symbols. I then wrapped a separate foreach loop around the current one and that duplicated the amount of images. I'm new to using the foreach loop with arrays and keys so still trying to get my head around it.
$images = array();
while ($rowhhh = mysqli_fetch_assoc($resulthhh)) {
$images[] = $rowhhh['photo_imagedata'];
$photo_id[] = $rowhhh['photo_id'];
}
foreach ($images as $image) {
if($photo_num==1){
echo '<a href="photo.php?photo_id='.$pid.'"><img class="stream_images" style="width:200px;height:200px;object-fit:cover;margin:2px;padding:2px;" src="data:image/jpeg;base64,'. base64_encode($image) .'" /></a>';
}else{
echo '<a href="photo.php?photo_id='.$pid.'"><img class="stream_images" style="width:100px;height:100px;object-fit:cover;margin:2px;padding:2px;" src="data:image/jpeg;base64,'. base64_encode($image) .'" /></a>';
}
}