The following code below displays results based upon the query. My question is how to I format 'UnitPrice' with 2 decimal places. I have no clue how becuse it is using the $key $val method to display results. I can't just say $val = number_format($val,2, ".", ","); because that will screw up the entire format. One of those results comes from the field 'UnitPrice' and this is the one I want to format. Please help, and thanks!
<?
$queryLU = "select * from OrderDetail where (OrderID = '$OrderID') ;";
//Loop through and set variables for data
$q_result = mysql_query($queryLU);
$number = MYSQL_NUM_ROWS($q_result);
while ($ary = mysql_fetch_assoc($q_result)) {
echo "<tr>";
while (list($key,$val) = each($ary)) {
$$key = $val;
if (($key <> "OrderID") && ($key <> "OrderDetailID")) {
echo "<TD><font class='text'>$val </td>";
}
}
$price = ($UnitPrice * $Quantity);
$extPrice = $price - ($price*$Discount);
$extPrice = number_format($extPrice,2, ".", ",");
echo "<td><font class='text'>$extPrice</td>";
}
?>