View Full Version : What is wrong with this code?
ERuiz
07-21-2007, 12:39 PM
I am trying a very simple plugin to display some results on a member's profile page. Look at the following 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:
$latest_pireps = $row['date'];
to:
$latest_pireps .= $row['date'];
ERuiz
07-21-2007, 12:59 PM
Change:
$latest_pireps = $row['date'];
to:
$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
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
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.