![]() |
mysql - sorting and calling help
Basically what I want to do is get the top 7 people with the most 'gold'.
This gives me the top person, but I need a way to get all 7. Any help? Thanks. PHP Code:
|
Use query rather than query_first, then loop over the results The class DB_site offers the function query_first as a shortcut for a) regular query, b) free mysql result storage, c) return the single row.
|
Quote:
|
Quote:
|
Quote:
I would have thought LIMIT 0,6 would return rows 0 through 6, making the first seven rows. Good to have learned something :) |
Yes Colin, I'm pretty sure what you said is right. LIMIT 0,6 would return the first 7 seven rows.
|
Can I get a quick example on how to loop the results, and store them each in SEPERATE variables? Thanks. ^__^;;
|
PHP Code:
That should work. you can then use the variables $name_1 - $name_7 as well as $gold_1 - $gold_7 |
Hey, wow! Thanks a lot! I'm prolly trying to do something too big as my first home-made hack of sorts, but this is one problem out of the way. Thanks again! :)
|
Quote:
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must be integer constants. With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. |
All times are GMT. The time now is 12:12 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|