Jump to content


This topic is now archived and is closed to further replies.


For Loops

Recommended Posts

ok so i have this code for my [b]for[/b] loop. now what i need to do is insert another 2 queries, one to select 2 things from the per who made the post, this will be done using the Poster_id, and another to select something from another table using Legion_id found within the query selected from the player.

[code]$query3="select poster_name, poster_id, board, post_date, reply_to, reply_body, reply_subject, post_id from forum where reply_to='$post'";
if (!$result3)
die (mysql_error());

for ($i=0;$i<$num_rows;$i++)

so i have the 2 queries:

[b]Query 1 using the poster_id[/b]
[code]$query4="select name, postcount, legion_id from players where playerid='$poster_id2'";
if (!$result4)
die (mysql_error());


[b]Query 2 using the legion_id[/b]
[code]$query5="select legion_name from legions where legion_id='$legion_id3'";
if (!$result5)
die (mysql_error());


all i need to know is where to place them in the loop. since when i put them in it only echos one result then kills the loop.

Share this post

Link to post
Share on other sites
the problem is that your second and third queries are using the same variables, $num_rows, $row, to go through the results.  Use $num_rows3, $row3, etc. and it should work.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.