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-09-2004, 05:41 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default how to fetch many rows from mysql

Could someone please help fix the below? It is returning only one row. Thank you

PHP Code:
// ####################################################################### 
// ######################## START MAIN SCRIPT ############################ 
// ####################################################################### 

$postinfos $DB_site->query("SELECT * FROM post WHERE award=1 and visible=1 ORDER BY dateline DESC");
$award = array();
while (
$postinfo $DB_site->fetch_array($postinfos))
{
exec_switch_bg();

$postid $postinfo['postid'];
$tid $postinfo['threadid'];
$uid $postinfo['userid'];
$date $postinfo['dateline'];
$username $postinfo['username'];
$title $postinfo['title'];    
mysql_free_result($postinfos);
}

$threads $DB_site->query("SELECT * FROM thread WHERE threadid=$tid");
$threadid = array();
while (
$threadinfo $DB_site->fetch_array($threads))
{
exec_switch_bg();
$ttitle $threadinfo['title'];
$forums $threadinfo['forumid'];
mysql_free_result($threads);
}
$theforums $DB_site->query("SELECT * FROM forum WHERE forumid=$forums");
$forumid = array();
while (
$foruminfo $DB_site->fetch_array($theforums))
{
exec_switch_bg();
$forum $foruminfo['title'];
mysql_free_result($theforums);
}
construct_forum_jump(); 
$navbits = array(); 
$navbits[$parent] = 'Editor\'s Pick'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";');

eval(
'print_output("' fetch_template('pick') . '");'); 
Reply With Quote
  #2  
Old 10-09-2004, 06:43 PM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mind explaining what you are trying to do?

As a general reminder on the forums, remember to post more specific details of your problem for a large chuck of code before assuming members will just instantly clue in. (especially when the code chunk isn't indented or formatted properly for readability)
Reply With Quote
  #3  
Old 10-09-2004, 06:53 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am trying to fetch the users who receives an award (from the awards hack) to display the post name in a different page, with a link to that awarded post, the user and his id, the thread name and the linked forum
Reply With Quote
  #4  
Old 10-09-2004, 11:27 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

here is an image of what I am desperately trying to achieve here and then click on thumbnail
Reply With Quote
  #5  
Old 10-10-2004, 02:55 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just glancing over your script, you're missing calling any template.

You'll have to call a template with .= for each run through you make while fetching the array. That'll add the new data to the variable. Then, insert the variable in the main template.

Make sure you have both templates set up
Reply With Quote
  #6  
Old 10-10-2004, 02:59 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for replying. Coincidentally I finally got it 5 minutes ago by altering another hack.
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 07:32 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.04559 seconds
  • Memory Usage 2,217KB
  • Queries Executed 11 (?)
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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete