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

Reply
 
Thread Tools Display Modes
  #1  
Old 10-03-2004, 08:22 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default how do I retrieve that info?

I am trying to get a list of polls that are active, and all I am getting returnes is the word "Array". I looked and can't figure out what is wrong. Can someone help, please?

$pollist = $DB_site->query("SELECT

thread.threadid AS thread_id,
thread.title AS thread_title,
thread.pollid AS thread_pollid,
poll.pollid AS poll_pollid,
poll.active AS poll_active,
poll.dateline AS poll_dateline,
poll.public AS poll_public,
user.userid, user.username
FROM

".TABLE_PREFIX."thread AS thread,
".TABLE_PREFIX."poll AS poll,
".TABLE_PREFIX."user AS user
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS dlog_t ON (dlog_t.primaryid = thread.threadid AND dlog_t.type = 'thread')
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS dlog_p ON (dlog_p.primaryid = poll.pollid AND dlog_p.type = 'poll')
WHERE
thread.pollid = poll.pollid AND
poll.active = 1 AND
dlog_t.primaryid IS NULL AND
dlog_p.primaryid IS NULL

ORDER BY poll.dateline DESC LIMIT 10");
while($pollist = $DB_site->fetch_array($pollist))
{
eval('$activepolls[\'pollist\'] .= "' . fetch_template('pollist') . '";');
}
unset($pollist);
$DB_site->free_result($pollist);
Reply With Quote
  #2  
Old 10-03-2004, 08:23 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This would be a fairly big and bogged down query, why not just use RSS feeds or xml or js?
Reply With Quote
  #3  
Old 10-03-2004, 08:30 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

and how would I do that? either one of them?
Reply With Quote
  #4  
Old 10-03-2004, 08:40 PM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this

PHP Code:
$pollist $DB_site->query("SELECT
        thread.threadid AS thread_id,thread.title AS thread_title,thread.pollid AS thread_pollid,poll.pollid AS poll_pollid,
        poll.active AS poll_active,poll.dateline AS poll_dateline,poll.public AS poll_public,user.userid, user.username
        FROM
                " 
TABLE_PREFIX "thread AS thread,
                " 
TABLE_PREFIX "poll AS poll,
                " 
TABLE_PREFIX "user AS user
        LEFT JOIN " 
TABLE_PREFIX "deletionlog AS dlog_t ON (dlog_t.primaryid = thread.threadid AND dlog_t.type = 'thread')
        LEFT JOIN " 
TABLE_PREFIX "deletionlog AS dlog_p ON (dlog_p.primaryid = poll.pollid AND dlog_p.type = 'poll')
        WHERE thread.pollid = poll.pollid AND poll.active = 1 AND dlog_t.primaryid IS NULL AND dlog_p.primaryid IS NULL
        ORDER BY poll.dateline DESC LIMIT 10"
        
);

                while(
$pollist $DB_site->fetch_array($showpollist))
                {
                        eval(
'$activepolls = "' fetch_template('pollist') . '";');
                } 
Then add $activepolls where you want the template to show, then in the template you can use the following calls $showpollist[thread_id], $showpollist[thread_title], $showpollist[thread_pollid], $showpollist[poll_pollid], $showpollist[poll_active]. $showpollist[poll_dateline], $showpollist[poll_public], $showpollist[userid], $showpollist[username].

Hope that helps.
Reply With Quote
  #5  
Old 10-03-2004, 08:55 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, thank you for your post. The template displays everything but the data itself.
Reply With Quote
  #6  
Old 10-03-2004, 08:58 PM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well in your orignal post you have eval('$activepolls[\'pollist\'] I don't belive the \ will work, but i could be wrong.

and you have while($pollist = $DB_site->fetch_array($pollist))

so you saying while calling the database query array the query again. you have $pollist as your db call and as you fetch_array.
Reply With Quote
  #7  
Old 10-03-2004, 09:13 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just copied and pasted yours, changing only the template values to match yours.
Reply With Quote
  #8  
Old 10-03-2004, 09:28 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I got it.It works when I put pollist instead of showpollist. Thanks
while($pollist = $DB_site->fetch_array($pollist))
{
eval('$activepolls = "' . fetch_template('pollist') . '";');
}
Reply With Quote
  #9  
Old 10-03-2004, 09:49 PM
Logikos Logikos is offline
 
Join Date: Jan 2003
Posts: 2,924
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That what i tried telling you. Glad its working

Quote:
Originally Posted by Lionel
I got it.It works when I put pollist instead of showpollist. Thanks
while($pollist = $DB_site->fetch_array($pollist))
{
eval('$activepolls = "' . fetch_template('pollist') . '";');
}
You forgot a $ in polllist
Reply With Quote
  #10  
Old 10-03-2004, 10:15 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Live Wire
That what i tried telling you. Glad its working



You forgot a $ in polllist
What $ ? I get it to display in showthread. My problem is I cannot get it to display in postbit where I need it in the first post. It is not displaying in posbits at all.
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 02:26 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.03873 seconds
  • Memory Usage 2,257KB
  • 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
  • (2)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
  • (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_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