array mysql_fetch_array ( resource result [, int result_type] )
返回根据从结果集取得的行生成的数组,如果没有更多行则返回 FALSE返回false就是没有,while都不会运行

解决方案 »

  1.   

    $result = mysql_query("select *,Count(*)as Total from newswhere id = ".$aid."",$link);
    while($data = mysql_fetch_array($result))
    {
    ..............
    }
    -----------
    if(Total==0){木有数据}
      

  2.   

    $num = mysql_num_rows($result)
    if($num==0)
    {
         echo "无数据";
    }
      

  3.   

    $result = mysql_query("select * from newswhere id = ".$aid."",$link);
    while($data = mysql_fetch_array($result))
    {
    ..............
    }
    if (!$data)
    {
    ..............
    }
      

  4.   

    $result = mysql_query("select * from newswhere id = ".$aid."",$link);
    while($data = mysql_fetch_array($result))
    {
    ..............
    }没有数据 $data 为 FALSE
      

  5.   

    $result = mysql_query("select * from newswhere id = ".$aid."",$link);
    $myrow = MySQL_fetch_array($result);
    if ($myrow){}else{
       //不存在该ID的数据
    }
      

  6.   

    没数据会报错  前面加@隐藏错误
    @$result = mysql_query("select * from newswhere id = ".$aid."",$link);
      

  7.   

    $result = mysql_query("select * from newswhere id = ".$aid."",$link);
    $num=mysql_num_rows($result);//取得记录数
    if ($num==0) { 
    echo "该数据记录不存在";
    }
    else {
      while($data = mysql_fetch_array($result))
      {
      ..............
      }
    }