Code has been added to clipboard!

Multiple MySQL Rows for MySQLi Procedural

Example
<?php
  $host = 'host';
  $user = 'user';
  $pass = 'pass';
  $db = 'db';
  // Create connection  
  $conn = mysqli_connect($host, $user, $pass, $db);  	
  // Check connection  	
  if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
  }
  $sql = "INSERT INTO users (username, password, email) VALUES ('Johny', 'Dawkins', '[email protected]');";  	
  $sql .= "INSERT INTO users (username, password, email) VALUES ('Margaret', 'Johnson', '[email protected]');"	
  $sql .= "INSERT INTO users (username, password, email) VALUES ('Juliete', 'Doodley', '[email protected]');";  	
  if (mysqli_multi_query($conn, $sql)) {    
    echo "New records created successfully";
  } else {    
    echo "Error: " . $sql . "<br>" . mysqli_error($conn);
  }
  mysqli_close($conn);  
?>