The mysqli_connect() is a tools in PHP that establishes a connection with mysql database. It is an important command that connect PHP and MySQL database.
PHP and MySQL's relation gets established due to mysqli_connect.
- · The mysqli_connect() function is used to establish a connection/relations of a MySQL database and PHP. This function a connection object on success, or false on failure.
- · It allows PHP to interact with a MySQL to perform operations like querying, selecting, droping, inserting, updating, and deleting data.
Coding To Establish Relation of PHP and MySQL
<?php
mysqli_connect("localhost", "root", "");
if (mysqli_connect_error()) {
echo "Connection Error.";
} else {
echo "Database
Connection Succeed .";
}
?>
Output of this coding is :
Database Conncetion Sucessfully.