title: Using MySQL "in" clause with a long string
body: <p>I'm working with an application that needs to make a where query to the database to return a rows with a "t1.address_city" (a column in the database) that is equal to any of the locations in an array. I understand I should be using implode() to make this into one big string, but this doesn't return any rows - presumably because it is looking for rows that match the big string (which of course isn't just one city, it is a list). Code:</p>
  
  <p><code>$_GET["places"]</code> contains something like this:</p>
  
  <p><code>["madrid", "lisbon", "london", "paris", "new york"]</code></p>
  
  <p>When the array name, $places, is put into the where clause like <code>IN ('$places')</code>, I get no rows. Following the advice of other similar questions on here, I imploded the array so that it looks like <code>"madrid, lisbon, london, paris, new york"</code> and then use the imploded variable  like <code>IN ('$implodedplaces')</code> but as mentioned earlier, it doesn't find any rows. </p>
  
  <p>I have found that entering each place name in quotes (<code>IN ('madrid','lisbon','london')</code>) separately works perfectly, but of course I need the IN clause to use the <code>$_GET["places"]</code> since this is manipulated by the user. Is there any way to enter all of the values in <code>$_GET["places"]</code> as separate strings with commas in between?</p>
  
  <p>Any help appreciated - feel free to ask questions if my explanation wasn't great.</p>