title: Search for a string in an array through SQL
body: <p>I have a table named '<em>offers</em>' that has a column <code>in_stores</code>. It contains the ids of the stores that this offer is available in. Graphically this table looks like this:</p>
  
  <pre><code>id | title    | in_stores
  1  | Shoes    | 1002,1003
  2  | Gloves   | 1020,1011
  3  | Shades   | 1002,1009
  4  | Hats     | 1010,1002
  5  | Shoes    | 1220
  6  | Shirts   | 1010
  7  | Hats     | 1002
  </code></pre>
  
  <p>Each value in <code>in_stores</code> is saved with the <code>implode()</code> function through PHP.</p>
  
  <p><strong><em>My question:</em></strong>
  How to select in a single <code>mysqli</code> query all the offers that are available in a store with id 1002. In this example the query should return offers with id 1,3,4,7. I guess I should use something like explode() first to get the results in an array and than in_array() to search for the specific id in it but all those functions are unavailable within SQL. </p>