josh
josh

Reputation: 1

mysql_fetch_assoc only returns 1 result

mysql_fetch_assoc is only fetching one record (checked database side of things all good)
Php Code:

<?php 
$folder_id = $_GET['folder_id'];
$query = mysql_query("SELECT * FROM gallery_photos WHERE folder_id = $folder_id");

if (mysql_num_rows($query) == 0)
{
    echo '<h2>Sorry, you cannot change a folders photo cover if that folder has 
         no    photos in it<br /> <a href="gallery.albums.php?fder_id='
         .$folder_id.'">Back to the folder</a><h2>';
}
else
{
    while ($row = mysql_fetch_assoc($query))
    {
        echo '<img src="gallery_photos/'.$row['photo_name'].'" width="200"';
    }
}
?>

Upvotes: 0

Views: 278

Answers (1)

Pelle
Pelle

Reputation: 6578

You're not closing the HTML IMG tag. Add the /> to your tag.

echo '<img src="gallery_photos/'.$row['photo_name'].'" width="200" />';

Upvotes: 3

Related Questions