I have this code,
$sqlstr = mysql_query(
"SELECT * FROM sales where passport = '{$therecord['passport']}'");
if (mysql_numrows($sqlstr) != 0) {
echo "<b>Sales for {$therecord['firstname']} {$therecord['lastname']}</b>";
while ($row = mysql_fetch_array($sqlstr)) {
echo "<table><tr>";
echo "<td>{$row['product']}</td>";
echo "<td>{$row['quantity']}</td>";
echo "<td>{$row['cost']}</td>";
echo "</tr>";
echo "</table>";
}
}
$sqltotal = mysql_query(
"SELECT SUM(cost) FROM sales where passport = '{$therecord['passport']}'");
echo "<b>Total Owing: {$sqltotal}</b>";
I would like to add a heading to each table column, and maybe some spacing between them.
How would I go about that?
Additionally, I am trying to use the SQL SUM function and output a total, but at the moment it outputs something like #id24 instead...