这对我来说毫无意义,但是这个查询显示一些完整的记录,一些部分显示,一些在一行中。似乎没有节奏或理由。更糟糕的是,当我在 MySql 中运行查询时,它工作得很好,完全没有问题。目前我认为它是一个恶魔和/或超级恶魔。
$sql = "SELECT phonenumber,date,dataplan AS currentplan, SUM(datamb) AS value_sum FROM maindata2 WHERE email='".($_POST['email'])."' GROUP BY phonenumber,date";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$query = mysql_query($sql) or die(mysql_error());
$header_printed = false;
while($row = mysql_fetch_array($query)) {
if ($row['phonenumber']) {
if ($header_printed === false) {
echo "
<table id='display'>
<tr>
<th>Phone Number:</th>
<th>Data Plan:</th>
<th>Data Usage This Period:</th>
<th>Remaining:</th>
<th>Date Reporting:</th>
</tr>";
$header_printed = true;
}
}
}
while ($row = mysql_fetch_assoc($result)){
echo "<tr>";
echo "<td>".$row['phonenumber'] . "</td> ";
echo "<td>".$row['currentplan'] . "MB</td> ";
echo "<td>".ROUND ($row["value_sum"],2) . "MB</td> ";
echo "<td>".($row['currentplan'] - ROUND ($row["value_sum"],2)) . "MB</td>";
echo "<td>".$row['date'] . "</td></tr>";
}
echo "</table>";
任何想法都会比我现在多一个!