title: MySQL - Get a row if a column's array value has a number in it
body: <p>I have been racking my brain looking for an answer to this <strong>very simple</strong> question. </p>
  
  <p>I have two tables with data in them. The first table contains a group of categories and their id. The second table contains a group of posts that can be linked to each category. Now I need to select the posts that are in each category, but it's not working the way I expect. I have tried using the IN operator and it works on the first value in the rows then doesn't on the rest.</p>
  
  <p>Here is how the tables are roughly structured </p>
  
  <p>Category Row Structure:</p>
  
  <pre><code>+===================+
  | cID  |   cName    |
  +===================+
  |  1   |  cars      |
  |  2   |  trucks    |
  |  3   |  kittens   |
  |  4   |  quads     |
  +===================+
  </code></pre>
  
  <p>Post Structure:</p>
  
  <pre><code>+==========================================+
  | pID  |   title    |  content  |   cats   |
  +==========================================+
  |  1   |  a post 1  | text here | 1,3,4    |
  |  2   |  a post 2  | text here | 2,3,4    |
  |  3   |  a post 3  | text here | 1,4      |
  |  4   |  something | text here | 2        |
  +==========================================+
  </code></pre>
  
  <p>When I visit the page for the <code>cars</code> category, it runs a query similar to this</p>
  
  <pre><code>$showFrom = 1; // THE cID of the Cars category
  query_function("SELECT .. FROM entries WHERE cats IN (?)", array($showFrom));
  // Query function just prepares the statement and passes the variables to the function
  </code></pre>
  
  <p>With this function I see <code>a post 1</code> and <code>a post 3</code> show up. Great. But if I go to the kittens or quads page, I am not seeing these posts. It stops reading after 1 in the first and 3rd item, and 2 on the second and fourth item.</p>
  
  <p>I considered using the CONTAINS function, but if they have more then 9 categories, and you visit category 1, you would see category 10 and 11 and so on as they would CONTAIN the literal value of  1 right?  Or am I missing something here?</p>
  
  <p>Thanks</p>