Jump to content

mysql_fetch_array into array


aeroswat

Recommended Posts

$_SESSION['arrays'] = array();
while ($row = mysql_fetch_assoc($result)) {
    $_SESSION['arrays'][] = $row;
}

echo "<pre>", print_r($_SESSION['arrays'], true), "</pre>";

 

Can you access that array by index and field? like this

 

$_SESSION['arrays'][0]['fieldName']
$_SESSION['arrays'][1]['fieldName']
$_SESSION['arrays'][0]['fieldName2']

 

etc

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.