![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Jan 2005
Location: Albany, NY
Posts: 43
Rep Power: 0
![]() |
Newest users, top 5.
Alright so I'm building alittle online community. I have the register, login, and file upload script already implemented and I'm trying to add a few nifty features. Anyway, on my home page I want to list the newest users that have register and the users with the highest number of photo uploads. In my table, I have a column named "id" which is auto incriminating (Everytime a new user registers it basically stores the number of that user). I also have a column named "picture_count" which stores how many pictures that user has uploaded. Unfortunitly, my mysql is shit, and I can't figure out how to search my table for the top 5 highest numbers in the "id" field", and the top 5 highest numbers in the "picture_count" field. Any help is apperciated.
|
|
|
|
|
|
#2 |
|
Professional Programmer
|
For the top highest 5 id numbers: SELECT * from table_name ORDER by id DESC LIMIT 5; or something to that extent.
For the top 5 picture count ones it would be similar: SELECT * from table_name ORDER by picture_count DESC LIMIT 5; It might be LIMIT = 5, can't remember off the top of my head. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|