Why does the following code return correctly when called explicitly for 1, but not when called in a for loop?
name: Granola price: 5.99
1 name: price:
2 name: price:
<?php
echo "name: " . $data[1][p_name];
echo " price: " . $data[1][price] . "<br />";
for ($i = 1; $i <= count($data); $i++) {
echo $i . " name: " . $data[i][p_name];
echo " price: " . $data[i][price] . "<br />";
}
?>