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

Reply
 
Thread Tools Display Modes
  #11  
Old 03-31-2004, 11:50 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Scrub
Instead of making another thread, I'll post in this one. . Anyways, I am stuck yet again and on something that I thought would've been easy to do. :x.

Anyways, I am trying to achive something like member.php does, but no luck in making it work. I've scanned countless files trying almsot everything. LOL. But I need to show a username according to the userid, hence like the member.php file. Thanks in advanced.
$userinfo = fetch_userinfo($userid);

Then $userinfo is an array that has all the user info such as username, $userinfo['username'], etc.
Reply With Quote
  #12  
Old 03-31-2004, 11:53 PM
Scrub's Avatar
Scrub Scrub is offline
 
Join Date: Oct 2001
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are the king! Thanks again!
Reply With Quote
  #13  
Old 04-10-2004, 05:10 PM
Scrub's Avatar
Scrub Scrub is offline
 
Join Date: Oct 2001
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello again!

I am currently trying to pull users from a specific usergroup out of the database. How would I go about doing that? This is the query I have. It only pulls one user out of the database.

PHP Code:
$user $DB_site->query_first("SELECT username FROM " TABLE_PREFIX " user WHERE usergroupid = 10"); 
Reply With Quote
  #14  
Old 04-10-2004, 05:42 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Using the query_first only gets the first result; use query instead, but then you need to use $DB_site->fetch_array($user); in a while statement.
Reply With Quote
  #15  
Old 04-13-2004, 10:34 AM
Scrub's Avatar
Scrub Scrub is offline
 
Join Date: Oct 2001
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey,
I appreciate all the help, Gary W. But I am comfused on the while statement. I can't seem to figure out how you make one pretty much. I've looked through the PHP Manual, vBulletin Manual, searched several PHP sites and I am still baffled. I understand a little part I belive.
PHP Code:
if ($_REQUEST['do'] == 'this_thing')
        {
                
$users $DB_site->query("
                            SELECT * 
                            FROM " 
TABLE_PREFIX " user AS user
                            WHERE user.usergroupid = 10
                            ORDER BY user.userid DESC
                            "
);

                while (
$user $DB_site->fetch_array($users))
                    {    
                        
$username fetch_musername($user);
                        eval(
'$main_template_bits = "' fetch_template('main_template_bits') . '";');
                    }

            eval(
'print_output("' fetch_template('main_template') . '");');
        } 
Amd I on the right track? LOL. And I'd very much appriciate if you can make a working sample of a while statement that is in KISS format. . Again, I'd like to thank you and everyone else for all the help.
Reply With Quote
  #16  
Old 04-13-2004, 10:09 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try something like
PHP Code:
if ($_REQUEST['do'] == 'this_thing'

    
$users $DB_site->query(
        SELECT * 
        FROM " 
TABLE_PREFIX " user AS user 
        WHERE user.usergroupid = 10 
        ORDER BY user.userid DESC 
    "
); 
    
    while (
$user $DB_site->fetch_array($users)) 
    {     
        
$username fetch_musername($user); 
        eval(
'$main_template_bits .= "' fetch_template('main_template_bits') . '";'); 
    } 
    
    eval(
'print_output("' fetch_template('main_template') . '");'); 

Then the main_template_bits would contain a <tr> most likely, or <br /> at the end.
Reply With Quote
  #17  
Old 04-13-2004, 10:31 PM
Scrub's Avatar
Scrub Scrub is offline
 
Join Date: Oct 2001
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks man! Though I still don't see where I went wrong at though. Could've it have actually been the template where I forgot the <br /> tag?

Edit: The <br /> kind of messed up the layout. So I removed it and it still works. .

Edit again: NEvermind. I missed a . in the eval part in the while query!

But thank you so much!
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 11:39 PM.


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.07063 seconds
  • Memory Usage 2,237KB
  • 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
  • (3)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
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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