vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   What is wrong with this code? (https://vborg.vbsupport.ru/showthread.php?t=152928)

ERuiz 07-21-2007 12:39 PM

What is wrong with this code?
 
I am trying a very simple plugin to display some results on a member's profile page. Look at the following code:

Code:

$pilotid = $userinfo['userid'];
$pilotid = "VAA".$pilotid;
$getlatestpireps = $db->query_read("SELECT * FROM pirep WHERE pilot_id = '$pilotid' ORDER BY date DESC LIMIT 10");
while ($row = $db->fetch_array($getlatestpireps)) {
$latest_pireps = $row['date'];
}

It will only display 1 result (the LAST result), instead of 10. What is wrong with it? Thanks for any help.

Marco van Herwaarden 07-21-2007 12:54 PM

Change:
PHP Code:

$latest_pireps $row['date']; 

to:
PHP Code:

$latest_pireps .= $row['date']; 


ERuiz 07-21-2007 12:59 PM

Quote:

Originally Posted by Marco van Herwaarden (Post 1297337)
Change:
PHP Code:

$latest_pireps $row['date']; 

to:
PHP Code:

$latest_pireps .= $row['date']; 


Hello sir,

Thanks for your reply! :up: Ok, I did what you suggested and here is what happens now:

http://www.virtualaa.com/forums/member.php?u=1

Any idea? :)

Marco van Herwaarden 07-21-2007 01:03 PM

Your question was why only the last entry was shown, that was easy ;) as you would overwrite the previous entry each time you went thru the loop.

If the result is what you expect that is a totally different question, and as i don't know what you expect to happed, i can not answer it.

ERuiz 07-21-2007 01:04 PM

Quote:

Originally Posted by Marco van Herwaarden (Post 1297348)
Your question was why only the last entry was shown, that was easy ;) as you would overwrite the previous entry each time you went thru the loop.

If the result is what you expect that is a totally different question, and as i don't know what you expect to happed, i can not answer it.

I fixed it. I had to change the hook to members_complete. It was set at members_customfields, so it was being called everytime a custom field was loaded.

THANKS because you did answer my question! lol


All times are GMT. The time now is 10:22 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.00992 seconds
  • Memory Usage 1,725KB
  • 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_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete