$cleanup_event = mysql_query('SELECT userid FROM ' . SQL_PREFIX . 'member WHERE last_ping < ' . $expire_time . ' AND is_online > 0');
         if(mysql_num_rows($cleanup_event) > 0) {
            while($row = mysql_fetch_assoc($cleanup_event))
               $notify_buddies = $this->userEvent($row['userid'], $this->getBuddylist($row['userid']), 'status', array('status'=>0));
         }运行结果:mysql_num_rows($cleanup_event) 为15
而$row = mysql_fetch_assoc($cleanup_event)=false
真奇了怪了大家遇到过这种情况吗?

解决方案 »

  1.   

    $row = mysql_fetch_assoc($cleanup_event)==false
      

  2.   

      if(mysql_num_rows($cleanup_event) > 0) {  //这一个判断为多余
      while($row = mysql_fetch_assoc($cleanup_event))  //如果取出的数据为空 while是不会执行的
      

  3.   

    不可能存在这种情况
    也没有看到 $row = mysql_fetch_assoc($cleanup_event)=false
    的证据
      

  4.   

    mysql_num_rows($cleanup_event)执行后,mysql_fetch_assoc($cleanup_event)就会返回错误,所以3楼正解。