| View previous topic :: View next topic |
| Author |
Message |
optomeb Enthusiastic Coder
Joined: 19 May 2006 Posts: 113
|
Hi..im trying to do a sql query from my db to select username and how many refferals they have(i have a refferal contest going) and finally figured out the sql query..would it be hard to put that in a table ?
Reply with quote
|
| |
|
|
Koplaf Enthusiastic Coder
Joined: 28 May 2006 Posts: 130
| |
optomeb Enthusiastic Coder
Joined: 19 May 2006 Posts: 113
|
I just don't imagine how, because the table would have to be defined by how many users have refferals
And that's always changing
Reply with quote
|
| |
|
|
Koplaf Enthusiastic Coder
Joined: 28 May 2006 Posts: 130
|
<table><caption>Referrals</caption><thead><tr><th>User</th><th>Refferals</th></tr></thead><tbody><tr><td>Koplaf</td><td>9 million</td></tr>....</tbody></table>
Just loop over your result set
You can always do fancy things like pagination, etc
Reply with quote
|
| |
|
|
optomeb Enthusiastic Coder
Joined: 19 May 2006 Posts: 113
|
The way i figured i'd do it is do a for i=1 to 30 or something and display the 30 first ones..
The 30 users with most refferals, i mean
So i would do the for loop before the table, and after that include the table in the for loop ?
Reply with quote
|
| |
|
|
montanarry Enthusiastic Coder
Joined: 13 May 2006 Posts: 175
|
optomeb: you can use LIMIT in your sql query to only fetch the top 30 users
Reply with quote
|
| |
|
|
optomeb Enthusiastic Coder
Joined: 19 May 2006 Posts: 113
|
montanarry, thanks ill look that up right now
I dont even know how to explain this...i should probably ask in #php but in my user tables i dont save how many refferals each user has..only who was the refferer when you signed up
Could i select who was the refferer for each user in the database and somewhat translate that to the username...then select and display the 30 usernames that reffered the most users ?
Reply with quote
|
| |
|
|
plantino Enthusiastic Coder
Joined: 13 May 2006 Posts: 96
| |
WarChild Enthusiastic Coder
Joined: 24 Feb 2006 Posts: 46
|
Keep close to the issue please. SQL has nothing to do with HTML. Do I have to create a new forum which will be SQL-related? Gimme a sign if this is needed.
Reply with quote
|
| |
|
|
optomeb Enthusiastic Coder
Joined: 19 May 2006 Posts: 113
| |
| Page 1 of 2 |
Goto page 1, 2 Next |
|