title: How to explode an array and save it in a database
body: <p>I have an array named bookseat in my php file.I've written a code to explode it and save it in my database.</p>
  
  <p>The code is as follows.</p>
  
  <pre><code>$bookseat = array(1, 2, 3);
  $arrlength = count($bookseat);
  $bookseatarray = explode(',', $bookseat);
  
  $conn = new mysqli($servername, $username, $password, $db);
  
  if ($conn-&gt;connect_error) {
      die("Connection failed: " . $conn-&gt;connect_error);
  } 
  
  if ($result = mysqli_query($conn, "SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'titan3d' AND TABLE_NAME = 'bookings'", MYSQLI_USE_RESULT)) {
          $row = mysqli_fetch_assoc($result);
          $now = $row['AUTO_INCREMENT'];
  } else {
      echo mysqli_error($conn);
  }
  
  for($i = 0; $i &lt; count($bookseatarray); ++$i){
      $SQL_project_has_type = "INSERT INTO bookseat (seat, bid)
      VALUES({$bookseatarray[$i]}, '$now')";
      mysql_query($SQL_project_has_type);
      }
  
  if ($conn-&gt;query($sql) === TRUE) {
      header('Location: http://localhost/My%20Project/booksuccess.html');
  } else {
      echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error;
  }
  
  $conn-&gt;close();
  </code></pre>
  
  <p>The part with the auto incrementation works,but the others doesn't seemed to work.</p>
  
  <p>When the code is on stage,I get an error as "Warning: explode() expects parameter 2 to be string, array given in C:\xampp\htdocs\My Project\JSFiles\book.php on line 25".</p>
  
  <p>What might be the error here?Can somebody help please!</p>