title: MYSQLI - WHERE IN array
body: <p>I've looked all over the internet for answers on this one, and prepared statements and bind params come up (I have no idea what that stuff is)</p>
  
  <p>Basically, I have a comma separated list</p>
  
  <pre><code>$list = 'food, drink, cooking';
  </code></pre>
  
  <p>Ok, now I want to search for each of those items in a column of the database... Sounds simple, right?</p>
  
  <pre><code>$query = "SELECT * FROM table WHERE stuff IN ('$list')";
  $runquery = mysqli_query($connection, $query);
  while($row = mysqli_fetch_array($runquery,MYSQLI_ASSOC)){
      $variable = $row;
  }
  </code></pre>
  
  <p>Then later on,</p>
  
  <pre><code>var_dump($variable);
  </code></pre>
  
  <blockquote>
    <p>UNDEFINED VARIABLE</p>
  </blockquote>
  
  <p>Why? I can't see anything wrong with the code. It works if I put a particular value, and I have tested it with <code>WHERE stuff=$item</code> - that works fine.</p>
  
  <p>So it's not the variables / database, it's an error in the IN statement. I don't understand why it won't work.</p>