这是我写的一个函数的代码:function sql_fetch_array_batch($query_id = 0)
{
while ($result[] = @mysql_fetch_array($query_id)) {
}
unset($result[count($result)-1]);
return $result;
}执行这个函数用了0.49秒,各位看看有没有更好的办法
{
while ($result[] = @mysql_fetch_array($query_id)) {
}
unset($result[count($result)-1]);
return $result;
}执行这个函数用了0.49秒,各位看看有没有更好的办法
{
// 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()试试。
这个办法不行,还不如我的省时间
while ($result[] = @mysql_fetch_array($query_id)) {
}
unset($result[count($result)-1]);的时间是0.49s,可是直接使用就用了0.26s,这是什么原因呢