这是我写的一个函数的代码:function sql_fetch_array_batch($query_id = 0)
{
while ($result[] = @mysql_fetch_array($query_id)) {
}
unset($result[count($result)-1]);
return $result;
}执行这个函数用了0.49秒,各位看看有没有更好的办法

解决方案 »

  1.   

    记得adodb中有一个将结果集直接存成数组的函数。帮你查一下。
      

  2.   

    function GetArray($nRows = -1) 
    {
    // if ($this->_arr) return $this->_arr;
    $results = array();
    $cnt = 0;
    while (!$this->EOF && $nRows != $cnt) {
    $results[$cnt++] = $this->fields;
    $this->MoveNext();
    }
    return $results;
    }
    方法都是差不多的。
    你用mysql_fetch_row()试试。
      

  3.   

    uGain(幽亙):
    这个办法不行,还不如我的省时间
      

  4.   

    发现一个问题,我写成类以后,在类里面测试了一下
    while ($result[] = @mysql_fetch_array($query_id)) {
    }
    unset($result[count($result)-1]);的时间是0.49s,可是直接使用就用了0.26s,这是什么原因呢