我寫了一個php文件,它想要打印出的電子郵件總數(總數),發送的電子郵件數量(發送)以及電子郵件數量還沒有發送給每個天。這裏是我的php文件如下顯示php表格的數據和計算
<?php
$total =0;
$sent =0;
$pending = 0;
$sql = "SELECT `sflag` , `thedate` FROM `ecard2008` WHERE `thedate` >= '2013-12-12'";
$list_mysql = mysql_query($sql) or mysql_error();
while($list = mysql_fetch_array($list_array)) {
$sflag = $list['sflag'];
$date = $list['thedate'];
if ($sflag == 0) {
$pending = $pending + 1;
}
else {
$sent = $sent + 1;
}
$total = $total + 1;
}
echo "<table border='1'>
<tr>
<th>Date</th>
<th>Daily volume</th>
<th>Sent</th>
<th>Pending</th>
</tr>";
echo "<tr>\n";
echo "<td>" . $date . "</td>";
echo "<td>" . $total . "</td>";
echo "<td>" . $sent . "</td>";
echo "<td>" . $pending . "</td>";
echo "</tr>";
echo "</table>";
?>
不幸的是,輸出只顯示錶和表的第一行。無法顯示電子郵件的數量。我能做些什麼來顯示這些數字。
是什麼'$ sFlag'? –
$ sflag是新變量的聲明,它保存sflag的選擇,這是從我的db – user3056561
好吧,但是sFlag代表什麼?它的意思是什麼? –