title: how to get count of another table
body: <p>Like below image I have two tables, now I want to get all columns from <code>Restaurant</code> table  depending on <code>cat</code> column, and number of records from <code>Foods</code> table that have that Restaurant id.</p>
  
  <p><img src="https://i.stack.imgur.com/5Sw7E.jpg" alt="enter image description here"></p>
  
  <p>example : (to get <strong>1,test</strong> from <code>Restaurant</code> table and <strong>3</strong> from <code>Foods</code> table).</p>
  
  <pre><code>$sql = "select * from Restaurant,Foods where cat=6..." ;
  </code></pre>
  
  <p>updated :</p>
  
  <pre><code>$sql = "r.*,(SELECT COUNT(*) FROM restaurant_foods WHERE restaurant_id = r.id)
      foods_count FROM restaurant r WHERE r.cats LIKE '%,$cat,%' limit $start,$end"
  </code></pre>