将逗号应用于表格 td 中的数字


Apply comma to numbers in td of table

我在mySQL生成的表中有一个数字列表:

如何将逗号应用于数字字段:"最小"和"最大"

$query = "SELECT min, max, qty FROM cartons_current LIMIT 0,50";
$result = $db->query($query, MYSQLI_STORE_RESULT);
$o = '<table><thead><tr><th>Min</th><th>Max</th><th>Qty</th></tr></thead><tbody>';
while(list($min, $max, $qty) = $result->fetch_row()) {
$o .= '<tr><td>'.$min.'</td><td>'.$max.'</td><td>'.$qty.'</td></tr>';}
$o .= '</tbody></table>';
echo $o;
?>

您可能想使用number_format() .

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