mysql result to array
<p>how is the fastest way to make a mysql result to an array?</p>

<pre><code>static function result($sql){
    if(!$result = self::$link-&gt;query($sql)){
        echo 'SQL: '.$sql.'&lt;br&gt;'.self::$link-&gt;error;
    }

    return $result;
}

static function rows($sql, $mode='assoc'){
    $result = self::result($sql);

    $row_arr = array();
    if($mode == 'assoc'){
        while($row = $result-&gt;fetch_assoc()) $row_arr[] = $row;
    }
    elseif($mode == 'row'){
        while($row = $result-&gt;fetch_row()) $row_arr[] = $row;
    }
    $result-&gt;close();

    return $row_arr;
}
</code></pre>
