The Arcive of vBulletin Modifications Site. |
|
Details »»
|
|||||||||||||||||||||||||
We are working on trying to use the include for top 25 posters on our index.php page...and we keep getting an error. We managed to put the latest 12 posts on the index.php page but adding the top posters isn't working.
COuld someone post the perfect :lol: script here with simple instructions for me to follow? I would sure appreciate it! ![]() Thanks! Kathy Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
untested, but it should work
Code:
<?
mysql_connect($my_host, $my_user, $my_pass);
mysql_select_db($dbase);
$action = mysql_query("SELECT userid, username from user ORDER BY posts DESC LIMIT 1,25");
while(list($userid, $username) = mysql_fetch_row($action)){
echo "<a href=\"member.php?action=getinfo&userid=$userid\">$username</a><br>";
}
?>
][Edited by Menno on 12-16-2000 at 11:15 AM] |
|
#3
|
|||
|
|||
|
Hmmm gives me a:
Parse error: parse error, expecting `','' or `';'' in /usr/local/etc/httpd/vhosts/friendswithoutfaces.com/htdocs/hot1.inc.php on line 9 Bet it's close, though. |
|
#4
|
|||
|
|||
|
try again
hm.... I really shouldn't code so late
|
|
#5
|
|||
|
|||
|
hmmm
Warning: 0 is not a MySQL result index in /usr/local/etc/httpd/vhosts/friendswithoutfaces.com/htdocs/hot1.inc.php on line 8 |
|
#6
|
|||
|
|||
|
You DID fill in the variables, right?
If so, change $action = mysql_query("SELECT userid, username from user ORDER BY posts DESC LIMIT 1,25"); to $action = mysql_query("SELECT userid, username from user ORDER BY posts DESC LIMIT 1,25") or die("Error: ".mysql_error()); that'll give you the error message
|
|
#7
|
|||
|
|||
|
Here is the code I was using on vBoard for a short time:-
<?php // Set this to the max number top posters to display $num = 25; $db=mysql_connect($servername,$dbusername,$dbpassw ord); mysql_select_db($dbname); $query = "SELECT * FROM user ORDER BY posts DESC LIMIT $num"; $resultlatest = mysql_query($query,$db); while ($latest_array = mysql_fetch_array($resultlatest)) { echo "<FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica, sans-serif\"> ? <A HREF=\"http://yourdomain/forums/member.php?action=getinfo&userid=$latest_array[userid]\">$latest_array[username]</A> ($latest_array[posts])</FONT><BR>"; } ?> See this: <A HREF=\"http://yourdomain/forums/member.php?action=getinfo&userid=$latest_array[userid] That url change it to the path to your member.php file like http://www.vboard.co.uk/board/member.php That will display the top 25 posters. |
|
#8
|
|||
|
|||
|
We're getting closer! Now I get:
Error: No Database Selected Now I have filled in the variables, so I'm not sure what the problem is this time. |
|
#9
|
|||
|
|||
|
sure you filled in $dbase? That's the only thing I can think of
|
|
#10
|
|||
|
|||
|
BTW, you got the earlier error message because I forgot to add slashes to the " chars
|
![]() |
|
|