Loop mysql query

Hello
I have 2 mysql tables. lets say One table has id and name, the other has id_pic, foto, description and name_id
I have a query that join both tables and make a comparation so i can have the name and the fotos and descriptions. I did this because each person can have multiple fotos. So one table has name of the persons and the other has pictures.
My query is: $query_rs_fotos = “SELECT * FROM table 1, table 2 WHERE table 1.id = table 2.name_id”;
Now i want to have the result of this query looped but i don’t know how to loop it and separate the data.
Lets say i have this data:
:::.table 1:::::
id | name
1 | john
2 | bob

::::table 2:::::
id_pic | foto | description | name_id
1 | bla.jpg | bla | 1
2 | buh.jpg | buh | 2
3 | yah.jpg | yah | 1
4 | boing.jpg | boing | 1
5 | bang.jpg | bang | 2
i want the loop to return something like:
<table>
<tr><td> john</td></tr>
<tr><td> bla.jpg</td><td> yah.jpg</td></tr>
<tr><td> boing.jpg</td></tr>
<tr><td> bob</td></tr>
<tr><td> buh.jpg</td><td> bang.jpg</td></tr>
</table>
How can i do this? ???