日期:2014-05-17  浏览次数:20523 次

获取mysql图片路径显示到网页
数据库里面 picture 是varchar类型 id.1的值是 c:\mypic\yyh.jpg

echo "<td width='10%'><img src=$title[picture] alt=\"images\"/></td>";这一段不会写 :

全部代码如下 :

<?php
$titlesql="select id,name,born,gender,identity_card,picture from myfamily;";
?>

<table width="100%" border="1" cellspacing="0" cellpadding="0">
  <tr> 
  <th width="13%">id</th>
  <th width="10%">name</th>
  <th width="7%">born</th>
  <th width="6%">gender</th>
  <th width="8%">identity_card</th>
  <th width="8%">picture</th>
  </tr>
  
<?php
while($title=mysql_fetch_array($titleresult)){
echo "<tr> ";
  echo "<td width='13%' align=center>$title[id]</td>";
  echo "<td width='10%' align=center>$title[name]</td>";
  echo "<td width='7%'>$title[born]</td>";
  echo "<td width='6%'>$title[gender]</td>";
  echo "<td width='8%'>$title[identity_card]</td>";  
  echo "<td width='10%'><img src=$title[picture] alt=\"images\"/></td>"; 
  echo "</tr>";
}
echo "</table>";
?>

------解决方案--------------------
少了引号
echo "<td width='10%'><img src='".$title[picture]."'></td>";