tags:

views:

135

answers:

3

how can i pass mysql_fetch_array() to array()

A: 

did you mean:

$variable = mysql_fetch_array($result); //$variable is now an array
erenon
A: 

mysql_fetch_array() is just a function that outputs an array, so you can simply attach it to any variable, like so:

$foo = mysql_fetch_array($bar);
Chad
+1  A: 

If you want to use it for multiple results you may want to assign within the while statement. Such as

$query = mysql_query("SELECT * FROM users");
$resultSet = array();
while($result = mysql_fetch_array($query))
{
    $resultSet[] = $result;
}
marvin