I have tried this to get array results to print, but not having much luck..
$arr_tot = array();
if($units=='all')
$query = "SELECT e_group, sum(amount * quantity) as total FROM expense where e_date between '$arr1_date'".
" and '$dep1_date' GROUP BY e_group";
else
$query = "SELECT e_group, sum(amount * quantity) as total FROM expense where e_date between '$arr1_date'".
" and '$dep1_date' GROUP BY e_group";
$result=mysql_query($query,$db_connection);
while($row=mysql_fetch_assoc($result));
$arr_tot[$row['e_group']] = $row['total'];
mysql_free_result($result);
$total = $row['e_group'];
print "<br><br><table align='center' width='100%' cellspacing='1'
cellpadding='5' bgcolor='#ffffff' class='main'>";
print"<tr><td valign='top' colspan='4'>
<p align='left' class='titlefont'><b>
Invoiced Sales</b></p></td></tr>";
print "<table align='center' width='98%' cellspacing='1'
cellpadding='5' bgcolor='#000000' class='main'>
<tr bgcolor='#D0CBA5'>
<td><b>Deposit</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>
<td> <b>GST</b> </td>
<td> <b>PST</b> </td>
<td> <b>HMT</b> </td>
<td> <b>Sales</b> </td>
</tr>";
print "<tr bgcolor='#ffffff'>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>";
print "</table>";
I am totally lost.. any help would be appreciated. Trying my query in phpAdmin does produce the results I want.. just can't get them to print in the table.
$arr_tot = array();
if($units=='all')
$query = "SELECT e_group, sum(amount * quantity) as total FROM expense where e_date between '$arr1_date'".
" and '$dep1_date' GROUP BY e_group";
else
$query = "SELECT e_group, sum(amount * quantity) as total FROM expense where e_date between '$arr1_date'".
" and '$dep1_date' GROUP BY e_group";
$result=mysql_query($query,$db_connection);
while($row=mysql_fetch_assoc($result));
$arr_tot[$row['e_group']] = $row['total'];
mysql_free_result($result);
$total = $row['e_group'];
print "<br><br><table align='center' width='100%' cellspacing='1'
cellpadding='5' bgcolor='#ffffff' class='main'>";
print"<tr><td valign='top' colspan='4'>
<p align='left' class='titlefont'><b>
Invoiced Sales</b></p></td></tr>";
print "<table align='center' width='98%' cellspacing='1'
cellpadding='5' bgcolor='#000000' class='main'>
<tr bgcolor='#D0CBA5'>
<td><b>Deposit</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>
<td> <b>GST</b> </td>
<td> <b>PST</b> </td>
<td> <b>HMT</b> </td>
<td> <b>Sales</b> </td>
</tr>";
print "<tr bgcolor='#ffffff'>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>".
"<td>". sprintf("%.2f",$total) . "</td>";
print "</table>";
I am totally lost.. any help would be appreciated. Trying my query in phpAdmin does produce the results I want.. just can't get them to print in the table.