Can somebody help?

Discussion in 'PHP' started by Marty Rogers, Jan 4, 2008.

  1. #1
    I have a field in my database table called viewed, does anybody know a small code that will add up all of the numbers in each viewed field for all entries and display the total? So if one field is 2, one is 3 and one is 1, it will display the total of 6. I need the full php/sql code because i'm not so good with it yet...

    Can anybody help me?

    Thank you.
     
    Marty Rogers, Jan 4, 2008 IP
  2. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #2
    search for something called sum in mysql

    something like this : $query = "SELECT SUM(viewed) FROM TABLE-NAME";
     
    commandos, Jan 4, 2008 IP