vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   top thread starters (https://vborg.vbsupport.ru/showthread.php?t=47272)

khaleejy 01-02-2003 04:42 PM

top thread starters
 
hi

ive searched here for this script but i find this:
1) some script called top 10 thread starters but it doesnt order the users by their threads number.. it order by the posts number.. and that is not what i want
2) another one create a new table to get the right top 10 thread starters..

any one knows how can iget it without creating any table?? please

Xenon 01-02-2003 05:02 PM

i think this query should do it, so try to include it in your script :)

[sql]SELECT COUNT(threadid) AS threads, username LEFT JOIN user ON(user.userid=thread.postuserid) GROUP BY thread.postuserid ORDER BY threads DESC LIMIT 10[/sql]

khaleejy 01-02-2003 05:25 PM

one more thing please
im not so good in php & mysql so could u help me with this:

PHP Code:

$topts=$DB_site->query("SELECT COUNT(threadid) AS threads, username LEFT JOIN user ON(user.userid=thread.postuserid) GROUP BY thread.postuserid ORDER BY threads DESC LIMIT 10");
while(
$topts=$DB_site->fetch_array($topts)) {

$threadcount=$topts['threads'];
$topusername=$topts['username'];

    }
eval(
"\$topts .= \"".gettemplate('forumhome_topts')."\";");
}
$DB_site->free_result($topts);
unset(
$topts); 

would $threadcount return to the number of threads of the user?? and $topusername return to the username???

im not sure.. please tell if there is any mistake

Xenon 01-02-2003 05:33 PM

no, that wouldn't work, you use the same variablename for three different things...

this would work:
PHP Code:

$topts=$DB_site->query("SELECT COUNT(threadid) AS threads, username LEFT JOIN user ON(user.userid=thread.postuserid) GROUP BY thread.postuserid ORDER BY threads DESC LIMIT 10");
$toptbits "";
while(
$topt=$DB_site->fetch_array($topts)) {

$threadcount=$topt['threads'];
$topusername=$topt['username'];

    
eval(
"\$toptbits .= \"".gettemplate('forumhome_topts')."\";");
}
$DB_site->free_result($topts); 


Xenon 01-02-2003 05:37 PM

sorry, little mistake ;)

use this:

PHP Code:

$topts=$DB_site->query("SELECT COUNT(threadid) AS threads, username FROM thread LEFT JOIN user ON(user.userid=thread.postuserid) GROUP BY thread.postuserid ORDER BY threads DESC LIMIT 10");
$toptbits "";
while(
$topt=$DB_site->fetch_array($topts)) {

$threadcount=$topt['threads'];
$topusername=$topt['username'];

    
eval(
"\$toptbits .= \"".gettemplate('forumhome_topts')."\";");
}
$DB_site->free_result($topts); 


Xenon 01-02-2003 05:40 PM

look above :)
i've forgotten the "FROM thread" part *gg*

khaleejy 01-02-2003 05:46 PM

ive reached here:

PHP Code:

// top thread starter
$topts=$DB_site->query("SELECT COUNT(threadid) AS threads, username FROM thread LEFT JOIN user ON(user.userid=thread.postuserid) GROUP BY thread.postuserid ORDER BY threads DESC LIMIT 10");
$toptsbits "";
while(
$topts=$DB_site->fetch_array($topts)) {
$threadcount=$topts['threads'];
$topusername=$topts['username'];
eval(
"\$toptsbits .= \"".gettemplate('forumhome_topts')."\";");
}
$DB_site->free_result($topts); 

and im getting this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/khaleejy/public_html/f/admin/db_mysql.php on line 154

notice: the line 154 has nothing to do with this script!!
line 152: unset($accessperm);
line 153:
line 154: // usergroup defaults
line 155: $usergroupdef['canview'] = $permissions['canview'];
line 156: $usergroupdef['canpostnew'] = $permissions['canpostnew'];

and im getting 1 username and his thread numebr only

Xenon 01-02-2003 05:48 PM

as i already told you above you can't use this:
PHP Code:

while($topts=$DB_site->fetch_array($topts)) {
$threadcount=$topts['threads'];
$topusername=$topts['username']; 

you HAVE to use this:
PHP Code:

while($topt=$DB_site->fetch_array($topts)) {
$threadcount=$topt['threads'];
$topusername=$topt['username']; 


khaleejy 01-02-2003 05:48 PM

do uthink that i have to include: (( WHERE open='1' AND open<>10 )) in the query?

khaleejy 01-02-2003 05:53 PM

sorry.. i thought that you made a type mistake when u wrote "topt" i thought that u missed the "s".. ignore post #9 anyway its working GREAT right now.. thank you very much :)


All times are GMT. The time now is 08:22 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
  • Page Generation 0.01015 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete