SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 1999
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can somebody point out the problem with this code?

    $query = "SELECT products, COUNT(products) AS count FROM clicks GROUP BY count DESC";

    I want to rank the products by the number of times they appear on the database.

    The database variables are: id, products, type, date, productid

    I think I only access products and productid in this program.

    Thanks in advance,
    Ian Chiu
    Editor in Chief
    http://www.usbworkshop.com/

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You won't be able to group by count but you can group by products

    $query = "SELECT products, COUNT(products) AS count FROM clicks GROUP by products ORDER BY count DESC";

    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 1999
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey, you are right!!!
    Ian Chiu
    Editor in Chief
    http://www.usbworkshop.com/


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
  •