【发布时间】:2018-05-12 18:18:40
【问题描述】:
在Image 中,您可以看到我的表格当前的显示方式,以及从 mysql 数据库中收集的商品价格,并显示为“500”或我希望它显示多少商品“ 500 英镑我尝试过数字格式,我尝试过使用和不使用语言环境,但仍然得到相同的error 目前使用 $ 只是为了测试*
感谢您的帮助! :D
include 'db_connection.php';
$conn = OpenCon();
echo "Connected Successfully";
setlocale(LC_MONETARY, 'en_US');
$sql = "SELECT * FROM Product, Manufacturer Where Product_ID = Manufacturer_ID";
$result = $conn->query($sql);
if ($result->num_rows > 0){
echo "<table>
<tr>
<th>Product ID</th>
<th>Name</th>
<th>Product Description</th>
<th>Price</th>
<th>Image</th>
<th>Manufacturer Name</th>
</tr>";
while($row = $result->fetch_assoc()){
echo "<tr>
<td>".$row["Product_ID"]."</td>
<td>".$row["Name"]."</td>
<td>".$row["Product_Description"]."</td>
<td>" '$'.number_format(floatval($row["ProductPrice"]));."</td>
<td><img src='images/".$row['ProductImage']."'></td>
<td>".$row["ManufacturerName"]."</td>
</tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
【问题讨论】:
标签: php mysql money-format