Sql Query Needed...

Started on the old forum in February 2008 · view the original in the archive · old links redirect here

8 replies · 616 views · started 18 years ago · 1 min read

3 participants
Guest #1

Hello ppl... i want to create a page which shows top 10 people on the basis of number of buds they have... Like one person have 20 buds, other have 35 and other have 50 buds, then the one with 50 buds shoud be on the top, then the one with 35 buds, then the one with 20 buds... I am using lavalair script.. what would be the SQL query for the same?? (Remember its lavalair database) I tried like hell... but cant succeed..... Any help would be much appreciated.. thanx..

alesh Lead · 604 posts #2

Open lists.php and use 1 of those hundrets of pages lol... Just replace sql query with what u need/want...

eeeeerrr....

Guest #3

I have already tried that..@Alesh Top posters, top chatters etc is easy.. But finding out people with most buddies is tricky... That buddies table is different... External image (may be gone)

rukiya Lead · 569 posts #4

put this code in index.php under $action=="viewuser"

$budnum = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
mysql_query("ALTER TABLE ibwf_users ADD bud INT( 100 ) NOT NULL DEFAULT '".$budnum[0]."' AFTER posts");

then make $action=="topbuds" like $action=="topp" in lists.php using the code

 $sql = "SELECT id, name, bud FROM ibwf_users ORDER BY posts DESC LIMIT $limit_start, $items_per_page";

then you yourself view all members profile once to work

mysql_query("ALTER TABLE ibwf_users ADD bud INT( 100 ) NOT NULL DEFAULT '".$budnum[0]."' AFTER posts")

for all members

Guest #5

Thanx rukiya... So it means all profiles has to be viewed once... to execute that query... Hmm..

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close