Heres my query:
Which returns the results I want, when run in phpmyadmin,
and what I want to do with the results:
Of course, as with many of my queries, I can't get from the query to the table.. can someone show where I have gone wrong?
Thanks!
Code:
$querye = "SELECT e_group, sum(amount * quantity) as total FROM expense where e_date between '$arr1_date'".
" and '$dep1_date' GROUP BY e_group";
$resulte=mysql_query($querye,$db_connection);
$rowe=mysql_fetch_object($resulte);
Which returns the results I want, when run in phpmyadmin,
and what I want to do with the results:
Code:
print "<br><br><table align='center' width='800' cellspacing='1'
cellpadding='5' bgcolor='#ffffff' class='main'>";
print "<tr><td valign='top' colspan='4'>
<p align='center' class='titlefont'>
Invoiced Sales</p></td></tr><table width=800 cellspacing='1' border='1'
cellpadding='5' bgcolor='#ffffff' border='1' align='center'><tr>";
print "<table align='center' width='800' cellspacing='1' border='1'
cellpadding='5' bgcolor='#000000' class='main'>
<tr bgcolor='#D0CBA5'>
<td><b>Date</b></td>
<td><b>Dep</b></td>
<td> <b>Fish</b> </td>
<td> <b>Misc</b> </td>
<td> <b>Snacks</b> </td>
<td> <b>Groceries</b> </td>
<td> <b>Cabin</b> </td>
<td> <b>Campsite</b> </td>
<td> <b>Rentals</b> </td>
</tr>";
print "<tr bgcolor='#ffffff'>".
"<td>". $arr1_date . " to<br>" . $dep1_date . "</td>".
"<td>". sprintf("%.2f",$rowe->e_group1) . "</td>".
"<td>". sprintf("%.2f",$rowe->e_group2) . "</td>".
"<td>". sprintf("%.2f",$rowe->e_group3) . "</td>".
"<td>". sprintf("%.2f",$rowe->e_group4) . "</td>".
"<td>". sprintf("%.2f",$rowe->e_group5) . "</td>".
"<td>". sprintf("%.2f",$rowe->e_group6) . "</td>".
"<td>". sprintf("%.2f",$rowe->e_group7) . "</td>".
"<td>". sprintf("%.2f",$rowe->e_group8) . "</td>".
print "</tr></table>";
Of course, as with many of my queries, I can't get from the query to the table.. can someone show where I have gone wrong?
Thanks!