For example, we have added a users table with three columns id, name, age with the following definition:
CREATE TABLE Users (id INTEGER AUTO_INCREMENT PRIMARY KEY, name VARCHAR(30), age INTEGER)
The INSERT command is used to add data to MySQL:
//connect to our test database $conn = new mysqli("localhost", "root", "password", "testdb"); //check connection on errors if($conn->connect_error){ die("Error" . $conn->connect_error);//return our errors } //add data to our tabble $sql = "INSERT INTO Users (name, age) VALUES ('Earl', 33), ('Homer', 24), ('Igor', 25) "; if($conn->query($sql)){ echo "Data sended"; } else{ echo "Error: " . $conn->error; } $conn->close();