title: What is the best way to pass an array from php to MySQL stored procedure?
body: <p>I am looking to pass a list of id's from PHP to a MySQL stored procedure so that I can then join to this list. I know that I don't want to pass the array as a csv list to the SP, but I'm not sure what the best practice is to do. </p>
  
  <p>With SQL Server I've built up a xml object which I then pass to the SP and join to this. This seems a bit like overkill, and I've never really been sure this is actually a good idea. </p>
  
  <p>Is there a simple, efficient way of taking by list of id's in an array in PHP and passing this into a MySQL SP which I can the use in a join?</p>
  
  <p>I've read through this related question, but haven't found the answer I was looking for:
  <a href="https://stackoverflow.com/questions/337704/parameterizing-an-sql-in-clause">Parameterize an SQL IN clause</a></p>
  
  <p>A related question that would solve my problem is this one:
  <a href="https://stackoverflow.com/questions/7023446/php-array-as-input-to-stored-procedure">PHP Array as input to Stored Procedure</a></p>
  
  <p>But I was looking to use a stored procedure rather than building up the SQL code within PHP.</p>
  
  <p>What would best practice be in this case?</p>