Totalling Up a Column
Attempting to Collate and Echo out the Total of the Price column specific to a given user, not fully experienced with DB's and cant see what my problem is, this code just echo's the last row 'price', but the user may have more than one row attached to their userid.
It's driving me mad...
$str_SQL = "SELECT * FROM basket WHERE user = '".$_SESSION['user']."'";
$resulttotal = $db->query_db('mydb',$str_SQL);
if(mysql_num_rows($resulttotal)>0)
{
while($rows = mysql_fetch_array($resulttotal))
{
$theprice=$rows['price'];
$totalprice=$theprice;
}
echo ''.$currencysymbol.' '.$totalprice.'<br>';
}
Any Help appreciated.
Subject
Written By
Posted
Totalling Up a Column
September 06, 2004 07:49AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.