id 1stPayment 2ndPayment 3rdPayment 4thPayment Tuition
8 0 200 2000 2000 9000
8 2000 0 0 0 0
9 0 0 0 0 1000
10 1 0 0 0 0
我想添加 id-8 的所有学费并回显学费总和的结果。我怎么能把所有的学费加起来而不加上其他身份证的学费。表名是“students_payments”...“我也想在自己的页面中回显一个 id 的学费,就像当我访问 id-8 的帐户时,它会显示其学费的总和。:D
我有这个代码,但是当我访问 id-9 和 id-10 的帐户时,它显示了所有学费的附加值。tnx 在高级.. :D
<?php
include("confstudents.php");
$id = $_GET['id'];
$result = mysql_query("select * from student_payments where id='$id' ");
while ($res = mysql_fetch_assoc($result)) {
$result = mysql_query("SELECT SUM(Tuition) FROM student_payments");
while ($row = mysql_fetch_assoc($result)) {
$TT = $row['SUM(Tuition)'];
echo "Php $TT";
}
}
?>