I'm using MS Access, but i have a little knowledge about MySQL
Hi,
MySQL would be better but let's press on anyway.
I assume you have a table of borrowers and some way of linking them to what they have borrowed?
When a member borrows a book you need a field against the member that indicates how many books have been borrowed. This is then incremented everytime the member borrows a book.
To display the top borrowers you run a simple peice of SQL to retreive the name and any file path to an avater they may have loaded and order the results by the borrow count and limit it to the top 10.
so assuming the table is tbl_members with ID, avatar and borrow_count as the fields we care about now:
-
select
-
a.ID, a.avatar, a.borrow_count
-
from tbl_members a
-
order by a.borrow_count desc
-
limit 0, 10
-
This will get you the top 10 borrowers. You could further restrict the results with a where clause so that only those who've borrowed more than a set number of items qualify as a top borrower to start with.
I hope this helps
nathj