mysql_fetch_assoc
只获取一条记录(检查数据库方面的一切都很好)
Php代码:
<?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"';
}
}
?>
答案 0 :(得分:3)
您没有关闭HTML IMG标记。将/>
添加到您的代码中。
echo '<img src="gallery_photos/'.$row['photo_name'].'" width="200" />';