Copy link to clipboard
Copied
Hi,
I have a mysql recordset that includes
'price_prd ' (item price - eg 14.95)
and
'amount_tax' (tax percentage to add - eg 17.5)
how can I show/ echo
<?php echo $row_rsPrd['price_prd']; ?> x 1.<?php echo $row_rsPrd[amount_tax]; ?>
price x 1.tax
...with only 2 deimal places?
much appreciated if anyone has the solution!
Copy link to clipboard
Copied
Have a look at PHP's built in function number_format :
http://php.net/manual/en/function.number-format.php
HTH
-Rob B
Copy link to clipboard
Copied
basic php math:
<?php
$price = $row_rsPrd['price_prd'];
$tax = $row_rsPrd[amount_tax];
$total = $price * $tax;
echo $total;
?>
Format $total by using number (or money) format function that was mentioned in the previous post.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more