Let's say I have something like this:
PHP Code:
while($row = mysql_fetch_array($Query))
{
$Foo = $Bar;
}
Furthermore, let's say that I want $Foo to end up with the product of the multiplication of two fields in the row,
Price and
Quantity. I could do this by replacing $Bar like:
PHP Code:
while($row = mysql_fetch_array($Query))
{
$Foo = $row['Price']*$row['Quantity'];
}
However, due to some weird coding I did a while back, I am currently in a situation where I need for this computation (not the product) to be stored in $Bar outside the while loop, and then have $Foo end up with the product of the computation when being assigned the value of $Bar. I can't figure out how to do this and would really appreciate your help.
I've tried doing it like:
PHP Code:
$Bar = "\$row['Price']*\$row['Quantity']";
while($row = mysql_fetch_array($Query))
{
$Foo = $Bar;
}
But $Foo ends up with the text of my intended computation, instead of the product being computed inside the loop.