Calculate Column Total.

Can someone help?

I’m trying to calculate the total from the “Comm:” column. (A.commission)

Can someone help??

Thanks.

[code]

<?php \$epstartdate = \$_POST["epstartdate"]; \$ependdate = \$_POST["ependdate"]; echo 'Print'; ?>
<?php \$rs = new Recordset(\$CFG->dbh); \$rs->DEBUG=0; \$v=0; \$o=0; \$w=0; \$r=0; if((\$epstartdate == "") || (\$ependdate == "")) { if(\$_SESSION["gUSER_ID"]!=3) { \$sql = "SELECT A.user_id, A.ticketnumber, A.date, A.airline, A.commission, A.notes, B.department, B.id FROM ticket A, user B WHERE A.user_id = B.id AND A.user_id ='".\$_SESSION["gUSER_ID"]."' ORDER BY A.airline"; } else { \$sql = "SELECT A.user_id, A.ticketnumber, A.date, A.airline, A.commission, A.notes, B.department, B.id FROM ticket A, user B WHERE A.user_id = B.id ORDER BY A.airline"; } \$rs->Execute(\$sql);
``````	while(!\$rs->EOF())
{

echo '<tr>
<td height="21" width="20%">'.\$rs->fields["ticketnumber"].'</td>
<td height="21" width="20%">'.\$rs->fields["date"].'</td>
<td height="21" width="20%">'.\$rs->fields["airline"].'</td>
<td height="21" width="20%">'.\$rs->fields["commission"].'</td>
<td height="21" width="20%">'.\$rs->fields["department"].'</td>
<td height="21" width="20%">'.\$rs->fields["notes"].'</td>
<td height="21" width="20%"><a href="main.php?opt=edit_tickets&ticketid='.\$rs->fields["ticketnumber"].'&deptt='.\$rs->fields["department"].'">Edit</a></td>
<td height="21" width="20%"><a href="main.php?opt=delete_tickets&ticketid='.\$rs->fields["ticketnumber"].'&del=yes">Delete</a></td>
</tr>';
if(\$rs->fields["department"] == "vendas")
{\$v++;}
if(\$rs->fields["department"] == "Owner")
{\$o++;}
if(\$rs->fields["department"] == "Reservation")
{\$r++;}
\$rs->MoveNext();
}
}

else
{
if(\$_SESSION["gUSER_ID"]!=3) {
\$sql = "SELECT
A.user_id, A.ticketnumber, A.date, A.airline,
A.commission, A.notes, B.department, B.id
FROM ticket A, user B WHERE A.user_id = B.id AND A.user_id ='".\$_SESSION["gUSER_ID"]."' AND A.date between '\$epstartdate' and '\$ependdate' ORDER BY A.airline";
}
else
{
\$sql = "SELECT
A.user_id, A.ticketnumber, A.date, A.airline,
A.commission, A.notes, B.department, B.id
FROM ticket A, user B WHERE A.user_id = B.id AND A.date between '\$epstartdate' and '\$ependdate' ORDER BY A.airline";
}
\$rs->Execute(\$sql);
while(!\$rs->EOF())
{
if(\$rs->fields["department"] == "vendas")
{\$v =(\$v+1);}
if(\$rs->fields["department"] == "Owner")
{\$o =(\$o+1);}
if(\$rs->fields["department"] == "Reservation")
{\$r =(\$r+1);}
echo '<tr>
<td height="21" width="20%">'.\$rs->fields["ticketnumber"].'</td>
<td height="21" width="20%">'.\$rs->fields["date"].'</td>
<td height="21" width="20%">'.\$rs->fields["airline"].'</td>
<td height="21" width="20%">'.\$rs->fields["commission"].'</td>
<td height="21" width="20%">'.\$rs->fields["department"].'</td>
<td height="21" width="20%">'.\$rs->fields["notes"].'</td>
<td height="21" width="20%"><a href="main.php?opt=edit_tickets&ticketid='.\$rs->fields["ticketnumber"].'&deptt='.\$rs->fields["department"].'">Edit</a></td>
<td height="21" width="20%"><a href="main.php?opt=delete_tickets&ticketid='.\$rs->fields["ticketnumber"].'&del=yes">Delete</a></td>
</tr>';
\$rs->MoveNext();
}

}
``````

?>

 View Tickets From:   To:
My Tickets
Ticket#:  Date:  Airline:   Comm:  Office:  Notes:  Edit:  Delete:
 Total Tickets: Total Offices: Vendas: Owner: Reservation: Webmaster:
[/code]