Posted by Rik on 02/07/07 23:13
Kenoli <kenoli.p@gmail.com> wrote:
> Suppose I have results from 2 queries each to a different table:
>
> $result1 =3D (mysql_query($query1);
>
> and
>
> $result2 =3D (mysql_query($query2);
>
> And I want to loop through both of them in order to put some values
> from each in a table.
>
> With one, I would do:
>
> while ($row1 =3D mysql_fetch_array ($result1)) { etc.
>
> <td><?=3D$row1['column1']?></td> etc.
>
> Suppose I want the next cell to be:
>
> <td><?=3D$row2['column1']?></td> //associated with $result2
>
> How do I construct the "while" conditional to loop through both
> queries????
>
> The results are linked by a common column (person_id).
Nesting while-loops is pretty simple. In 99% of the cases someone asks =
this, it's far simpler and efficient to write a query that holds the =
desired results of the 2 though. Could you tell us more about the tables=
=
and the exact query?
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|