This makes no sense to me, but this query display some records in full some in partial and some in a single line. With seemingly no rhythm or reason. Even worse when I run the query in MySql it works just fine with no issues at all. Currently I am thinking it is a demon and/or super demon.
$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>";
Any thoughts would be one more than I have right now!