数据库里面 picture 是varchar类型 id.1的值是 c:\mypic\yyh.jpgecho "<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>";
?>

解决方案 »

  1.   

    alt属性用于为图像指定备选文本。备选文本是无法加载图像时显示的文本
    http://www.w3school.com.cn/tags/att_img_alt.asp
      

  2.   

    我想说.其实你写的SQL代码.仅仅是写了.但没有执行.
    现在的$titlesql的值仅仅等于"select id,name,born,gender,identity_card,picture from myfamily;"这一堆字符串.
    如果你想执行,必须要在下面加上这一句
    mysql_query($titlesql);
    这样SQL语句才会被执行.然后就是筛选数据库字段了.
    大概如下吧:
    $titlesql="select id,name,born,gender,identity_card,picture from myfamily;"
    $sql=mysql_query($titlesql);
    $row=mysql_fetch_accos($sql);
    //执行SQL语句;
    echo $row['title'];
    //输出字段;
    然后在下面的表格中打<?php echo $row['字段名'] ?>就能输出字段对应的文本了.
    现在你是想输出图片.那就<img src="<?php echo $row['picture'] ?>" >这样的就能输出图片了.
      

  3.   

    picture 是varchar类型 id.1的值是 c:\mypic\yyh.jpg ???1、将 c:\mypic\ 置于 web 服务范围里。
    apache 的话,修改 httpd.conf 在最后加入 
    ALIAS /mypic "c:/mypic"2、将 echo "<td width='10%'><img src=$title[picture] alt=\"images\"/></td>"; 改写为
    $pic = strtr(substr($title['picture'], 2), '\\', '/');
    echo "<td width='10%'><img src=$pic alt=\"images\"/></td>";
      

  4.   

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

  5.   

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