Sorry, I'm not sure I fully understand.
I have included a global variable in the script because I thought that without doing that the variable $price may be out of scope after the brackets, which of course may be wrong.
The value contained within $row, once converted to a float would represent the cost of the item.
Is this statement within the while loop, wrong for producing the running total?
$price=$price + $price;