21,891
社区成员




<?
require_once("connect_sql.php");
$sql="select * from table_2 ";
$result=mysql_query($sql,$link) or die("failed to display the picture");
$row=mysql_fetch_array($result);
$data=base64_decode($row['logo']);
header("Content-type: image/jpeg");
echo $data;
//$data=base64_decode($row['logo']);
//header("Content-type: image/jpeg");
//echo $data;
?>
我的代码只能显示一张图片
但是我想将我的数据库中的图片都显示在一个页面上,总是出现警告和乱码!!不知道是为什么!!请高人指点!
//list.php
$result=mysql_query("select logoid from table_2");//logoid为主键
if(@mysql_num_rows($result))
while($row=mysql_fetch_row($result))
echo "<img src='show.php?logoid={$row[0]}'/>";
//show.php
$result=mysql_query("select logo from table_2 where logoid=".$_GET['logoid']);//要防注入
if(@mysql_num_rows($result)){
$row=mysql_fetch_row($result);
header("content-type:image/jpeg");
echo base64_decode($row[0]);
}