-1
<?php
$con=mysqli_connect("localhost","root","root","test");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$results = mysqli_query($con,"SELECT SUM(jumlah) AS jumlah_sum FROM finance_income");
echo '<center>';
while($rows = mysqli_fetch_array($results));
{
echo "<p>" . "Rp " . number_format($rows['jumlah_sum']) . "</p>";
}
echo "</center>";
mysqli_close($con);
?>
我已經改變了一些代碼,但是當我打開這個PHP文件,它不加我的所有號碼,它只是在網上有人打印0知道是什麼發生?我想用PHP來顯示列的總和,但它給我0
Full texts
id
timestamp
nama
cat_id
jumlah
1
2013-10-26 14:08:18
test
Iuran
400000
2
2013-10-26 22:06:35
test
Donasi
2000000
3
2013-10-27 10:51:32
test
Iuran
100000
4
2013-10-27 10:55:01
test
Iuran
100000
5
2013-10-27 11:01:38
test
Iuran
100000
6
2013-10-27 11:02:07
test
Iuran
100000
是我的數據庫 謝謝您,瑞安
var_dump($ results);告訴我它的結果是什麼? – underscore
你正在將mysqli_ *函數與mysql_ *函數混合在一起.. – Nelson
**用你的MySQL組合來粘住你的輻條**。並不是所有的'MySQL_' –