 <p>It would be helpful if you showed the SQL statement that returns the results.</p> <p>Are the returned arrays in separate $row results?</p> <p>In that case you need to iterate through each $row result, something like:</p> <pre><code>foreach($query-&gt;result() as $row) { for ($p=1; $p&lt;=2; $p++) { echo number_format($row["novhigh_".$p],2); } } </code></pre> <p>On a side note: It looks like the key definition inside the arrays is not logical, why not have the same key value for the "novhigh" element? </p>