'); $y_row = array_fill(0, $max_y, $z_row); $arr3d = array_fill(0, $max_x, $y_row); unset($y_row, $z_row); // Do not waste memory */ $query = "SELECT x, y, z, value FROM mapinfo WHERE id='{$player_id}'"; $handle = mysql_query($query) or die("$query: error: " . mysql_error()); while($row = mysql_fetch_array($handle)) { // $row is an array with x, y, z and value keys in this order list($x, $y, $z, $value) = $row; /* This if we had used mysql_fetch_assoc instead $x = $row['x']; $y = $row['y']; $z = $row['z']; $value = $row['value']; */ if (!isset($arr3d[$x])) $arr3d[$x] = array(); if (!isset($arr3d[$x][$y])) $arr3d[$x][$y] = array(); $arr3d[$x][$y][$z] = $value; } mysql_free($handle);