title: PDO insert a simple array into MySQL database
body: <p>I have a form which allows multiple text boxes for users to add different question names, these are then passed to an array: </p>
  
  <pre><code>name="question_name[]
  </code></pre>
  
  <p>How do i go about inserting this array into my questions table using PDO and MySQL? I have tried:</p>
  
  <pre><code>$sql = "INSERT INTO questions (`question_name`) VALUES (:question_name)";
  $stmt = $db-&gt;prepare($sql);
  $stmt-&gt;bindValue(':question_name', $question_name);
  $stmt-&gt;execute();
  </code></pre>
  
  <p>This gives me </p>
  
  <blockquote>
    <p>Array to string conversion" error. </p>
  </blockquote>
  
  <p>I have tested the <code>print_r</code> statement and the results are as expected:</p>
  
  <pre><code>Array ( [0] =&gt; [Answer1] =&gt; [2] =&gt; [Answer2]) 
  </code></pre>
  
  <p>etc... depending on the amount of text boxes used. </p>
  
  <p>I understand that it is to do with BindValues / BindParam / execute() statement I would just like a correct method that works and reasoning to help me learn. Thanks. </p>