SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How do I add all fields in a coulm?

    I have a rating system and I want to make a stats-page. On my stats-page I want to print the total number of ratings, so I guess I have to add all the fields in the "ratings"-column where the number of ratings per item is stored. How can this be done? (if possible at all...)

    Thanks,
    Sensei

  2. #2
    SitePoint Wizard GoldFire's Avatar
    Join Date
    Oct 2002
    Location
    Oklahoma City, OK
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    #pulls them
    $ratings mysql_fetch_array(mysql_query("SELECT SUM(ratings) FROM table" ));
    #prints them
    print "".$ratings['0'].""


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
  •