大多数数据库类包括你用的mysqli,都有一个fetch_all方法。虽然名字可能不同,但功能都是相同的——以二维数组的形式返回$result的内容

解决方案 »

  1.   

    //======================================
    // 函数: fetchAll()
    // 功能: 从记录集中取出所有记录
    // 返回: 记录集数组
    //======================================
    function fetchAll()
    {
    $arr = array();
    while($this->record = mysql_fetch_array($this->queryID,$this->fetchMode))
    {
    $arr[] = $this->record;
    }
    mysql_free_result($this->queryID);
    return $arr;
    }
      

  2.   

    to xuzuning(唠叨):
    mysqli 没有fetch_all这个函数.并不提供返回所有结果集的功能 .
    只能一行一行的foreach.
      

  3.   

    mysqli result的方法只有这么多了.mysqli_result
    Represents the result set obtained from a query against the database. 方法close - closes resultsetdata_seek - moves internal result pointerfetch_field - gets column information from a resultsetfetch_fields - gets information for all columns from a resulsetfetch_field_direct - gets column information for specified columnfetch_array - fetches a result row as an associative array, a numeric array, or both.fetch_assoc - fetches a result row as an associative arrayfetch_object - fetches a result row as an objectfetch_row - gets a result row as an enumerated arrayclose - frees result memoryfield_seek - set result pointer to a specified field offset