Hi,
I have two arrays which are the result of 2 mysql queries. I want to combine them so I can and loop through them as I would a single returned result array.
I've tried using array_merge, and $newarray = $array1 + $array2;, but neither of those methods seems to give me the right output.
Any ideas on how I would do that? Current code pasted below, thanks:
$test=mysql_fetch_array($result);
$row2=mysql_fetch_array($result2);
$row = array_merge($test, $row2);
for($i=0,$n=10; $i<$n; $i++) {
print $row[username];
}
I have two arrays which are the result of 2 mysql queries. I want to combine them so I can and loop through them as I would a single returned result array.
I've tried using array_merge, and $newarray = $array1 + $array2;, but neither of those methods seems to give me the right output.
Any ideas on how I would do that? Current code pasted below, thanks:
$test=mysql_fetch_array($result);
$row2=mysql_fetch_array($result2);
$row = array_merge($test, $row2);
for($i=0,$n=10; $i<$n; $i++) {
print $row[username];
}
Comment