Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 02-21-2001, 06:06 PM
Guest
 
Posts: n/a
Default

<html>
<head>
<title>blabla</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#000000" text="#CCCCCC" link="#CCCCCC" vlink="#CCCCCC" alink="#CCCCCC" leftmargin=0 rightmargin=0 bottommargin=0 topmargin=0>
<?php
require("global.php");

print("<table><tr><td colspan=\"2\">Top Posters</td></tr>
<tr><td><b>Username</b></td><td><b>Posts</b></td></tr>");

$db_link = @mysql_pconnect("$dbservername", "$dbusername", "$dbpassword");
mysql_select_db ("$dbname", $db_link)
or die("Error connecting to DB");

$query = mysql_query("SELECT posts, username FROM user ORDER BY user.posts DESC, user.username DESC LIMIT 0, 10")
or die("Query Error:$query");

while($row = mysql_fetch_array($query))
{
$username = $row["username"];
$posts = $row["posts"];

print("<tr><td>$username</td><td>$posts</td></tr>");
}

print("</table>");

?>

that's the script I use ,and this is the error I get :

Warning: Supplied argument is not a valid MySQL-Link resource in /web/sites/3/blabla111111/www.blabla.f2s.com/board/main.php on line 15
Error connecting to DB
Reply With Quote
  #12  
Old 02-21-2001, 08:01 PM
Guest
 
Posts: n/a
Default

$db_link is wrong I think , with what should I replace it ?
Reply With Quote
  #13  
Old 02-22-2001, 04:26 PM
Guest
 
Posts: n/a
Default

do you have this in the same directory had global.php? if not you have to have the full path for it to open it
Reply With Quote
  #14  
Old 02-22-2001, 05:11 PM
Guest
 
Posts: n/a
Default

it's in the same directory
Reply With Quote
  #15  
Old 02-23-2001, 08:37 PM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by JimF
Sorry, I wasn't thinking...

PHP Code:
<?php
require("path/to/global.php");

print(
"<table><tr><td colspan=\"2\">Top Posters</td></tr>
<tr><td><b>Username</b></td><td><b>Posts</b></td></tr>"
);

$db_link = @mysql_pconnect("$dbservername""$dbusername""$dbpassword");
mysql_select_db ("$dbname"$db_link);

$query mysql_query("SELECT posts, username FROM user ORDER BY user.posts DESC, user.username DESC LIMIT 0, 10");

while(
$row mysql_fetch_array($query))
          {
          
$username $row["username"];
          
$posts $row["posts"];

          print(
"<tr><td>$username</td><td>$posts</td></tr>");
          }

print(
"</table>");

?>
Put this in any page you want to. Just change the path to global.php and the LIMIT statement to reflect how many people you want to display. It's set at 10.

HTH

-jim
I got it to work by making a file inside the vBulletin folder, setting the global require path to just require("global.php"); and then called the file using the reltivie path (eg. include ("http://www.yourdomain.com/vBulletin/topposters.php") and everything worked nice and quickly.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:50 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04537 seconds
  • Memory Usage 2,196KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete