How can I copy an array that has other associative arrays in it?
I am talking about a result set returned from a mysql_fetch_assoc
.
So say I have a structure like this...
connect
$result = query;
while ($row = mysql_fetch_assoc($result)) {
array_push($static_row, $row); // here lies the problem
}
I would like to get that $static_row
exactly as a copy of $row
. Eventually I would like to put that query and while loop in a function, and simply return $static_row
As a reference, a print_r
of $row
looks like this
Array ( [key1] => value1 [key2] => value2 )
Array ( [key1] => value1 [key2] => value1 )
Thanks, let me know if you need more details