I run a SELECT query on my mysql database. The results are to be stored in an array $ar.
I then change the SELECT statement and run it again. This time the results need to be stored in an array $ar2. These two arrays then need to be mearged into 1 for further processing. Not new to programing but new to this. Any help you can give would be greatly appreciated.
<?PHP
// First query run here.
$result=mysql_query($sql);
$num=mysql_num_rows($result);
$ar=array();
$i=0;
while($i < $num)
{
$ar[]=mysql_result($result,$i,"pic");
$ar[]=mysql_result($result,$i,"Title");
$ar[]=mysql_result($result,$i,"Directions");
$ar[]=mysql_result($result,$i,"Notes");
}
// Second query run here
$result=mysql_query($sql);
$num=mysql_num_rows($result);
$ar2=array();
$i=0;
while($i < $num)
{
$ar2[]=mysql_result($result,$i,"pic");
$ar2[]=mysql_result($result,$i,"Title");
$ar2[]=mysql_result($result,$i,"Directions");
$ar2[]=mysql_result($result,$i,"Notes");
}
//merge arrays into 1
$ar3=array();
$ar3=array_merge($ar,$ar2); //array_merge($array1, $array2);
?>