If statement in a while loop

please am trying to do a calculation and am putting a if stament in a while loop but not getting the total price the

mark up is below



   $pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
  while ($row = mysql_fetch_assoc($pplresult))
   //echo $row['Pquantity'] * $row['Price'];
  {
   $totalPrices += $row['Tprice'];
    if(0.1*$totalPrices <= 50 )
    {
    $totalPrice = (0.1*$totalPrices +  $totalPrices);
    }
    else
   {
    $totalPrice = 50 + $totalPrices;
        }

  }
  //echo "$totalprice";

         ?>
<tr>
                <th>Total Price</th>
                <th><?php echo $totalprice; ?></th>

            </tr>

I HAVE SOLVED IT THANKS

Why not write this operation into the query?