If you have data coming from two different querys and they become two different arrays, combining them is not always an answer.
There for when placed into an array ([]) they can be looped with a foreach to count how many, then looped together.
Note: they must have the same amount in each array or one may finish before the other…..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?php foreach ($monthlytarget as $value) { // find how many results there were $loopnumber++; } echo $loopnumber; for ($i = 0; $i < $loopnumber; $i++) { echo $rule[$i]; echo " - "; echo $monthlytarget[$i]; echo "<br>"; } ?> |