I pull some info out of my DB and store it in a variable called $Price if the user has more than 1 item stored in the DB i want to add the values together, can someone please help.
Thanks in advance![]()
| SitePoint Sponsor |





I pull some info out of my DB and store it in a variable called $Price if the user has more than 1 item stored in the DB i want to add the values together, can someone please help.
Thanks in advance![]()
"Am I the only one doing ASP.NET in Delphi(Pascal)?"



in php you could do:
where you're fetching an array of the mysql results called row.PHP Code:$price=$price + $row['price']
In mysql you could:
Code:SELECT sum(price) FROM table WHERE user='$user_id'
Oz
GamersMark - On Target Gaming
OzTheory - Programming and Web Solutions
AmIBlocked - Check if you've been blocked on IM





im in your dept, thx.
had to change the mysql code a little to this:
as you can see i have added "as Price"PHP Code:$Result1 = mysql_query("SELECT sum(Price) as Price FROM shoppinglist WHERE UserId = '" . $_SESSION['UserId'] . "'");
Thanks again![]()
"Am I the only one doing ASP.NET in Delphi(Pascal)?"
Bookmarks