OK, I've been at this one for a little while. My brain's a little fried, so hopefully I can explain this properly.
What I'd like to do is create a blank 2-dimensional array, and then fill it with data from a database query. Here's the code that I have (which doesn't work):
$result = mysql_query($sql, $connection);
$numRows = mysql_num_rows($result);
$numCols = mysql_num_fields($result);
$typeArray = array(array());
for ($i=0; $row = mysql_fetch_row($result); $i++){
for ($j=0; $j < $numCols; $j++){
$typeArray[$i][$j] = $row[j];
}
}
for ($i=0; $i < $numRows; $i++){
for ($j=0; $j < $numCols; $j++){
echo "$typeArray[$i][$j] - $typeArray[$i][$j]<BR>\n";
}
}
There's the code. I am about 99% sure that the problem is in the way i initialize the array (the "$typeArray =" line). However, I can't find the correct way to do it anywhere.
Any takers?
Thanks a ton (and I really mean that, I'm going nuts here).....
-Phil