MySQLi INSERT INTO statement is used to insert data into MySQLi table.
Below the syntax of INSERT INTO command
INSERT INTO table_name
(field1, field1,...fieldN)
VALUES
(value1, value2,...valueN);
MySQLi INSERT INTO statement is used to insert data into MySQLi table.
Below the syntax of INSERT INTO command
INSERT INTO table_name
(field1, field1,...fieldN)
VALUES
(value1, value2,...valueN);
<?php
$conn = mysqli_connect('localhost:3306', 'user_name', 'password', 'db_nexladder');
if(! $conn) {
die('Could not connect: ' . mysqli_error());
}
$sql = "INSERT INTO `tbl_customers` (first_name, last_name) VALUES ('Vijay', 'Singh'), ('Ram', 'Singh')";
if (mysqli_query($conn, $sql)) {
echo "Record created successfully";
} else {
echo "Error:". mysqli_error($conn);
}
mysqli_close($conn);
?>
Output: Record created successfully
Below it'll look like