In PHP, SQL queries will only return result sets. Rows and columns.
You need another loop to process it into the array you are accessing. This is not a problem and should be part of your database shell if you use it often.
$result = mysql_query(...);
$aData = array();
while($row = mysql_fetch_assoc($result))
$aData[$row['id']] = array($row['x'], $row['y'], $row['z']);
source
share