Code: Select all
$result = mysql_query ("
SELECT * FROM matterusersrights
INNER JOIN matterdata ON matterdata.clientcode = matterusersrights.clientcode
WHERE matterusersrights.userid = $cookieid");
while ($row = mysql_fetch_object($result)) {
$totalestimate += $row->estimate;
echo "<br/>
<b> $row->persondealing</b><br/>$row->clientcode-$row->matterno
$row->estimate<br/>
$row->total<br/>
$totalestimate
";
}
mysql_free_result($result);
mysql_close($sqlconn);Two tables, one of userid's and rights, and the other showing the data, with the "rights" data in it's own column. The user is given rights to the "clientcode" in matterdata.
I can produce all data for the given clientcode only, and show all the answers, but what I WANT to do is to only show the "persondealing" and the total of all $total and $estimate figures.
So if Joe Bloggs has two entrys. His estimates are £2000 and £500. And his Totals are £1500 and £250.
The results need to be:
Estimate total: £2500
Total total: £1750.
I just can't get it to do it. It produces really strange numbers, that I cannot even equate!
If any of this doesn't make sense, please message me as I am dying to crack it.
Simon
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: