I'm creating a image gallery where people can add comments to each uploaded image.
I've made a db tabel for all comments including a foreign key to match the image table. My SQL variable looks like this and seems to work fine:
$all_comments_one_image_sql="
SELECT userimage.id, image_id, comment, id, comment_date
FROM userimage, image_comment
WHERE image_comment.image_id=userimage.id
ORDER BY comment_id DESC
";
But when I'm doing my while function for all my gallery images, where and how would I echo the right comments to each image?