vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Richest Person Points (https://vborg.vbsupport.ru/showthread.php?t=73382)

Alchemist 12-27-2004 11:39 PM

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?

Dean C 12-28-2004 10:29 AM

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 :)

Alchemist 12-28-2004 12:32 PM

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?

Zubaz 12-28-2004 12:36 PM

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.

Alchemist 12-28-2004 12:42 PM

So, I should run that as a query via PHPmyadmin, and then...? Again, I apologize for my ignorance.

Zubaz 12-28-2004 12:51 PM

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.

Alchemist 12-28-2004 01:00 PM

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. :(


All times are GMT. The time now is 06:03 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.01258 seconds
  • Memory Usage 1,720KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete