![]() |
Help!
ok this is want i am trying to do.
I have added an extra field to the user table called amtdonation. what I want to do is make a page that will display the members with the highest amtdonation Example: user 1 has 10.00 user 2 has 20.00 and user 3 has 5.00 what I want to generate is a page that has 1. user 2 20.00 2. User 1 10.00 3. User 3 5.00 Total amount = 35.00 a top list of donators it would be display like username in one cell and donation in second field then the total at the buttom can anyone make this or tell me where to start by giving me some sample code ? Thanks |
PHP Code:
|
Hi, GSHelpBoy,
Just a friendly reminder - to download hacks and get support you will need to go to this page and enter your email address, to show you are licensed. (you will need to use your customer number and password to access that page) Thank you. :) |
maybe I better redo this question.
using vb's global tag at the top what would I have to do to display like I said before ? |
Umm u mean vB's
$DB_site-> ?? |
No the whole code on what i would need ;)
|
Umm you mean
[sql]$DB_site->query("'SELECT `user`, `amount`, SUM(`amount`) FROM `donation` ORDER BY `amount`');[/sql] ??? Sorry, but you are not being clearn on what you which to accomplish here. |
yeah like that but how would I display the output of it into tables to be like a top 10 list ?
|
You would loop it...in like for instance using a while(), your file archive hack seems to use it...err well of course it does, because the code is from mine :-p....just check out your err file hack, and you will see how to do it.
|
my file file archive hack ? I didn't make one ?
|
Use this code:
PHP Code:
|
I think that will work great... i haven't tried yet.
Will that order the users from 1-10 by total amount of user then sum the total of all of them at the buttom? btw thanks for the code :) |
nope didn't work giving this error
Invalid SQL: SELECT `user`, `amount`, SUM(`amount`) AS `total` FROM `donation` ORDER BY `amount` DESC LIMIT 10 mysql error: Table 'forum.donation' doesn't exist i have the amount in the user table under field amount? |
I thought you already had the donation table created...
|
no i just have a field under the table user called amount which is where I put the amount of the donation.
? |
Umm the archive hack of which the structure for was taken from my hack. Anyways
|
Any hoo, though I am 100% sure it was you, you posted this thread to get help, so it doesn't matter anyways.
|
I never did a file achieve hack...i think you are thinking of someone else ?
|
but anyways going back to that script..
I made the donations table with fields (user, amount) it now displays them in a list but it don't sort them or sum the amounts for each user and put them into a top 10. also the total amount at the buttom don't work. I have to change ORDER BY to GROUP BY or i got an error Invalid SQL: SELECT `user`, `amount`, SUM(`amount`) AS `total` FROM `donation` ORDER BY `amount` DESC LIMIT 10 mysql error: Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause :( |
All times are GMT. The time now is 02:10 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:
|