In the program, I want to create table to print out the date in (Y/M/D) format, volume, pending and sent. However, it show nothing after execution. It can be executed using phpmyadmin in the SQL. However, I do not know whether we can use two SQL statements to find out two different condition. I need your help.
$start = date('2013-12-12');
$today = date("Y/m/d");
echo "Today's date: " .$today;
$result = mysql_query("SELECT count(semail) AS av FROM table WHERE `thedate`>='2013-12-12' GROUP BY `thedate` ")or die(mysql_error());
$row = mysql_fetch_assoc($result) or die("No rows returned by query");
$totalofemail = $row['av'];
$sent = mysql_query("SELECT count(semail) AS av FROM table WHERE `sflag`='1' AND `thedate`>='2013-12-12' GROUP BY `thedate`")or die(mysql_error());
$result = mysql_fetch_assoc($sent) or die("No rows returned by query");
$sentemail = $result['av'];
$pending = $totalofemail - $sentemail;
echo "<table border='1'>
<tr>
<th>Date</th>
<th>Daily volume</th>
<th>Sent</th>
<th>Pending</th>
</tr>";
if($i=0; $i<($today-$start); $i++)
{
echo "<tr>\n";
echo "<td>" . $row['thedate'] . "</td>\n";
echo "<td>" . $totalofemail . "</td>\n";
echo "<td>" . $sentemail . "</td>\n";
echo "<td>" . $pending . "</td>\n";
echo "\n</tr>\n";
echo "</table>\n";
}