Hi, Given the array $array initialized by:
$query = "SELECT id,name FROM MYTABLE"; $result = mysql_query($query); $nrows = mysql_num_rows($result); for ($i=0; $i<$nrows; $i++) { $arr = mysql_fetch_array($result); $array[$i]['id'] = $arr['id']; $array[$i]['name'] = $arr['name']; } I know I can have a similar 'for' loop to step through the array, from 0 to count($array) But I would like to do something more elegant, with a foreach loop. But I have been unsuccessful as a foreach seems appropriate only with a single dimensional array. Can someone suggest a more elegant solution? Thanks, Rich P.S. yes, I am fairly new to PHP, less than 6 months. Probably my array loading method could be improved also!