$exec="select * from a"; 
$result=mysql_query($exec,$conn) or die(mysql_errno.'-'.mysql_error()); 
if(mysql_affected_rows()==0)
{
  echo "没有数据显示";
}
while($rs=mysql_fetch_object($result))

echo $rs->a_title;  //这里的a_title是a表中的一个键值 

解决方案 »

  1.   


    $exec="select * from a"; 
    $result=mysql_query($exec,$conn) or die(mysql_errno.'-'.mysql_error());
    if(mysql_num_rows($result) == 0)
    {
      echo "还没有数据";
    }这样也可以.
      

  2.   

    可能我说的还不够详细
    <?php
    $exec="select * from a"; 
    $result=mysql_query($exec,$conn) or die(mysql_errno.'-'.mysql_error()); 
    while($rs=mysql_fetch_object($result)){ 
    ?>
    <table border="1px"><tr><td>
    <?php
    echo $rs->a_title;  //这里的a_title是a表中的一个键值 
    ?>
    </td></tr></table>
    <?php

    ?>
    我想实现的是,当A中没有值的时候,table是不出现的,而现在的情况是,即便 A中没有值,但table还是出现的
      

  3.   

    <?php 
    echo "
    <table border='1px'> <tr> <td> ";echo $rs->a_title;  //这里的a_title是a表中的一个键值 echo " </td> </tr> </table> ";?>