Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-27-2004, 11:39 PM
Alchemist Alchemist is offline
 
Join Date: Jul 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Richest Person Points

Hey,

I need help. I use Reeve of Shinra's points hack. I need to run a query so I can display the Top to the Lowest person with points. Can anyone help?
Reply With Quote
  #2  
Old 12-28-2004, 10:29 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry I did a search and couldn't find this modification here? Could you please tell me the name of the field in the user table which holds the points for a user?

Also note, displaying all your users is not a good idea, you'll need to implement this into a PHP script and group it into pages otherwise it's not going to be very efficient
Reply With Quote
  #3  
Old 12-28-2004, 12:32 PM
Alchemist Alchemist is offline
 
Join Date: Jul 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's Reeve of Shinra's Points hack for vBulletin 2. The profile field is called "Money" (don't worry, it's actually called money, unlike field4, just to clear that up). Perhaps i should list only the top 30 users with the most points and place it in somewhere called richest.php . I can install hacks, yet, I'm just a copy and paster. If you can, can you assist me with what query to run?
Reply With Quote
  #4  
Old 12-28-2004, 12:36 PM
Zubaz Zubaz is offline
 
Join Date: Dec 2004
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
$query = mysql_query("SELECT * FROM `users` WHERE 1 ORDER BY `money` DESC LIMIT 0, 30 ");
while($user = mysql_fetch_array($query)) {
echo "$user[username] has $user[money] money.<br>";
}
or something to that effect.
Reply With Quote
  #5  
Old 12-28-2004, 12:42 PM
Alchemist Alchemist is offline
 
Join Date: Jul 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, I should run that as a query via PHPmyadmin, and then...? Again, I apologize for my ignorance.
Reply With Quote
  #6  
Old 12-28-2004, 12:51 PM
Zubaz Zubaz is offline
 
Join Date: Dec 2004
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That depends on what you're trying to do. If you just want to make a static html file with your current top 30, then you'd put that query (line 1) in phpMyAdmin and copy the results, if you want to make a dynamic richest.php, then you take the code I put above, and put it in a file that connects to the database.

To explain the code:
line 1: This is the query to the database. You're searching all users, ordering by the money field, sorting in descending order, and then take the first 30 positions after 0 (aka the first 30).
line 2: This is a while statement that will parse through all 30 of your results. As in, this chunk of code will get called 30 times since we're going to have 30 results from teh previous query.
line 3: echo() is just a function that will print the following string to the user, so you're printing "USERNAME has # money.<br>". This would return 30 lines, with USERNAME and # replaced with the top 30 users. Just for formatting purposes, you might want to start a table. Something like:

<table>
<tr><td>User</td><td>Money</td></tr>

then your echo string would be "<tr><td>$user[username]</td><td>$user[money</td></tr>";

then close your table with:
</table>

I'm not sure how much HTML you know, but you can pretty up the table as you see fit with the rest of the page.
Reply With Quote
  #7  
Old 12-28-2004, 01:00 PM
Alchemist Alchemist is offline
 
Join Date: Jul 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm trying to create a file called richest.php . I'm good with html, but, I wouldn't know how to make a file with the header, footer, navbist, etc using php language, then make a template after. If I can give you (or anybody else) an admin password to my forums, and the person who wants to do this does the php file, and sends it to me, that'd be great. I'm just not sure where to go from here, but Zubaz thus far you've been an excellent help! I'd ask another staff member but no one has real knowledge on how to work .php and MYSQL.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:31 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
  • Page Generation 0.04443 seconds
  • Memory Usage 2,216KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete