vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   how do I retrieve that info? (https://vborg.vbsupport.ru/showthread.php?t=70146)

Lionel 10-03-2004 08:22 PM

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);

Zachery 10-03-2004 08:23 PM

This would be a fairly big and bogged down query, why not just use RSS feeds or xml or js?

Lionel 10-03-2004 08:30 PM

and how would I do that? either one of them?

Logikos 10-03-2004 08:40 PM

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.

Lionel 10-03-2004 08:55 PM

Hi, thank you for your post. The template displays everything but the data itself.

Logikos 10-03-2004 08:58 PM

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.

Lionel 10-03-2004 09:13 PM

I just copied and pasted yours, changing only the template values to match yours.

Lionel 10-03-2004 09:28 PM

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') . '";');
}

Logikos 10-03-2004 09:49 PM

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 :p

Lionel 10-03-2004 10:15 PM

Quote:

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



You forgot a $ in polllist :p

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.


All times are GMT. The time now is 04: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.01027 seconds
  • Memory Usage 1,754KB
  • 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
  • (1)bbcode_php_printable
  • (2)bbcode_quote_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