php - 在数字中添加逗号

标签 php mysql

<html> <head>   <title>Rough Diamond 
 Information</title> </head> 
<body>

<?php

mysql_connect("localhost","root","");
mysql_select_db("basic");
$order = "select * from calculator ";
$result=mysql_query($order);

echo "Rough Diamonds Information:&nbsp; &nbsp; &nbsp; &nbsp;";
echo "<a href='home.html'>Go to main page <br><br>";
?>


<table border="1" style="width:50%">
<tr>
    <th><b>ID</b></th>
    <th><b> Name</b></th>
    <th><b> Total Rough Weight</b></th>
    <th><b>One Carat Price</b></th>
    <th><b>Dollar Rate</b></th>
    <th><b>Payment Days</b></th>
    <th><b>Total Payment</b></th>
</tr>

<?php while($row = mysql_fetch_array($result) ) {

echo "<tr>
<td>".$row['id']."</td>
<td>".$row['name']."</td>
<td>".$row['total_wt']."</td>
<td>".$row['crt_price']."</td>
<td>".$row['dollar_rate']."</td>
<td>".$row['pay_day']."</td>
<td>".$row['total_price']."</td>
</tr>";} ?>

</body>
</html>

最佳答案

使用number_format($number);

查看http://php.net/manual/en/function.number-format.php

关于php - 在数字中添加逗号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33295816/

相关文章:

php - Laravel 5.7 - 广播 - socket.io - redis : Nothing happen on client

javascript - 如何在页面加载时使用 mysql 查询结果设置单选按钮值后触发 javascript 函数

mysql - 由于违反外键约束,无法将数据添加到 MySQL 表中

mysql - 使用命令行客户端将多个文本文件及其部分标题导入Mysql表

php - 获取字段中最常见的条目时没有结果

mysql - 如何连接到iPage mysql数据库

php - 如何修复 laravel 5.4 中的警告 Illegal string offset?

php - 使用 SSL 时是否有引用 header ?

PHP - 使用 HTTP_REFERER 测试 iframe 的父页面是否可靠?

php - 如何在 phpunit 中进行严格的相等/三重相等比较?