Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-02-2003, 04:42 PM
khaleejy khaleejy is offline
 
Join Date: Jul 2002
Location: a
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 01-02-2003, 05:02 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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]
Reply With Quote
  #3  
Old 01-02-2003, 05:25 PM
khaleejy khaleejy is offline
 
Join Date: Jul 2002
Location: a
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 01-02-2003, 05:33 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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); 
Reply With Quote
  #5  
Old 01-02-2003, 05:37 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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); 
Reply With Quote
  #6  
Old 01-02-2003, 05:40 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

look above
i've forgotten the "FROM thread" part *gg*
Reply With Quote
  #7  
Old 01-02-2003, 05:46 PM
khaleejy khaleejy is offline
 
Join Date: Jul 2002
Location: a
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 01-02-2003, 05:48 PM
khaleejy khaleejy is offline
 
Join Date: Jul 2002
Location: a
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

do uthink that i have to include: (( WHERE open='1' AND open<>10 )) in the query?
Reply With Quote
  #9  
Old 01-02-2003, 05:48 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']; 
Reply With Quote
  #10  
Old 01-02-2003, 05:53 PM
khaleejy khaleejy is offline
 
Join Date: Jul 2002
Location: a
Posts: 72
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply


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 12:11 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.04326 seconds
  • Memory Usage 2,279KB
  • 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
  • (6)bbcode_php
  • (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
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • postbit_imicons
  • 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