Math with PHP/MySQL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
cupaball
Forum Commoner
Posts: 85
Joined: Sun Feb 12, 2006 1:46 pm

Math with PHP/MySQL

Post by cupaball »

Hi All:

Quick question, I have a table with the number of people coming to a party and I would like to display the results (easy enough, right). That part I am having a challenge with is adding the total number at the bottom of the results. Can someone point me in the direction of a tut?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Math with PHP/MySQL

Post by Christopher »

You can add them up as you loop through the rows to display the data. Or you can use the SUM() function in SQL. See the MySQL docs for examples.
(#10850)
Post Reply