Forum Moderators: coopster
Items are being displayed after query of database as in the format (looping - rows):
echo "Price = $row[price] ....
How do you use the number format function inside an echo statement referring to rows? I want to add commas to my price values in each row displayed.
12345 would change to 12,345, etc.
I've used the number format before, but never in a looping row echo statement.
<?
$decimal_places = 2;
echo "price ". number_format($row['price'], $decimal_places). " ";
?>
careful though, number_format() rounds up numbers if you dont use the optional parameters.
also you can try money_format.
[us3.php.net...]
[us3.php.net...]
though it isn't always recommended as it becomes hard to follow at some point
you could do this
$mytexttoinsert = mysql_real_escape_string(strip_tags(trim($_POST['somevalue'])));
I have one somewhere with quite a few more than that but couldn't find it for an example
and the way to learn new functions, is to read the manual