2016.6.21 PHP与MqSQL交互之图片读取
<td width="265">
<?php
mysql_select_db("member");
mysql_query("set character set utf8");
mysql_query("set name utf8");
$result=mysql_query("SELECT * FROM `purchasemessages`where pur_tuijian=1 order by pur_id desc limit 0,1");
$info=mysql_fetch_array($result);
if($info==false){
echo "本站暂无商品!";
}
else{
?>
<table width="270" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="130" rowspan="5"><div align="center">
<?php if(trim($info[pur_pic]=="")){
echo "暂无图片";
}
else{
?>
<img src="<?php echo $info[pur_pic];?>" width="80" height="80" border="0"> //MySQL中读取的是图片的相对路径,这个相对路径存储在字段pur_pic下 (..\Images\08.jpg)
<?php
}
?>
</div>
</td>