PDA

View Full Version : [help]i need a little help


squawell
12-15-2001, 05:37 PM
this is the problem code:


$fileviews=$DB_site->query_first("SELECT count(*) AS profileviews FROM user ORDER BY profileviews DESC LIMIT 1");
$proviews=$fileviews['profileviews'];


but the $proviews=totalmembers what's wrong??


hope anybody help me finish it~~plz~~~:D

amykhar
12-15-2001, 05:56 PM
all this query did was count the total number of users and store it in a variable called profileviews. What are you trying to calculate?

Amy

squawell
12-15-2001, 06:44 PM
i want to calculate the top profileviews of forum member!!

just like :

The Top Profileview:username(numbertimes)!!

any idea?? :confused:

amykhar
12-15-2001, 07:17 PM
assuming that you have been counting the profile views, it's simple.

Select profileviews as profileviews from user order by profileviews DESC;

That will order them from highest to lowest. You just grab as many as you need then. If you only need the top 5 or so, you can add a LIMIT 5 at the end.

If you haven't been incrementing that field when somebody looks at a user's profile though, that query won't do anything for you.

Amy

squawell
12-15-2001, 07:45 PM
thankz amy~~~:D

now it's work!!

another question

if i want the top 5 show up with pop up window how should i do?

any idea?