title: Join 2 mysql queries, where the second query depends on the output of the first
body: <p>I use my first query to get the id and name of the user like this:</p>
  
  <pre><code>select id,name from temp_card where sex='$sex' and city='$city' order by name ASC
  </code></pre>
  
  <p>Then I have a second query that uses the results from the first, and gets more data from another table:</p>
  
  <pre><code>select images from temp_card_images where temp_card_id=". $row['id'] ." order by id ASC limit 1
  </code></pre>
  
  <p>How can I combine these two queries so that I can print out the 3 fields (id, name and images) in a single while loop?</p>
  
  <p>Thank you!</p>