SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    273
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry addition of values using php and mysql

    hi there

    I have a table which has 30 rows .

    in each row there is a different value

    what i am stuck at is , i want to add all the rows and get the total SUM of all the 30 rows.
    i am unable to do this in php.....with the looping logic....i tried using while loop..

    please let me know

    the table has 30 values one after the other and the output is the sum of all those values...thats the problem please help me..people..

  2. #2
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is more of a database question than a PHP question. But, how about trying:
    PHP Code:
    $sql "SELECT SUM(column1) AS mysum FROM mytable"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •