I have some an array which is the result of an sql query and I want to loop through all of the item in the array and echo them out as part of my code and in some cases the same field is echoed several times.
What would be faster for me to do in this case 1. assign these to variables like so before I start my loop:-
$itemid = $row[‘item_id’]
$itemname = $row[‘item_name’]
or 2. simply keep accessing them via the array access operator [] as I do currently?
Below is a very simplified example of my code
[code=php]
<?php do{?>
<?php
echo $row[‘item_id’]
echo $row[‘item_name’]
?>
<?php }while($row = mysql_fetch_array($result));?>