title: MySQL PHP 'Filter' for Services
body: <p>I've been racking my brain all day trying to figure this one out! I'm hoping you guys can help.</p>
  
  <p>I'm building a PHP system which will filter out records for 'Suppliers' within a MySQL table.</p>
  
  <p>The services are stored in a table as such:</p>
  
  <pre><code>id
  service
  </code></pre>
  
  <p>The suppliers are stored in a table as such:</p>
  
  <pre><code>id
  company_name
  </code></pre>
  
  <p>Then after much reading, I added an additional table, which links the suppliers, to their corresponding services:</p>
  
  <pre><code>id
  supplier_id
  service_id
  </code></pre>
  
  <p>One supplier can offer many services.</p>
  
  <p>When a user clicks on a filter (span tags which have jQuery on clicks, which capture the id of the service clicked), I want to display the suppliers which offer that service. When a user clicks an additional service, I want to display only the suppliers that offer both of those services. And so on...</p>
  
  <p>I am struggling to establish a) is this the correct way forward, and b) what the SQL would be for it. At the moment, I pass the additional service ID to PHP using $.GET, and store a string of them all as a CSV in Session variables.</p>
  
  <p>Many thanks in advance,</p>
  
  <p>James</p>