Connect to database using php mysqli In order to connect to MySQL database using mysqli, mysqli_connect function is used, you need to provide host name , username , password and database name . Connect to database using php mysqli – procedural way In procedural way mysqli_connect function is used. mysql_connect function opens a connection to database server and connection object is returned. If connection to database fails mysqli_connect_errno() throws an error. <?php $host = "localhost"; $user = "root"; $password = ""; $database = "dbusers"; $mysqli = mysqli_connect($host, $user, $password, $database); if (mysqli_connect_errno($mysqli)) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } ?> Connect to database using php mysqli – object oriented way Object oriented way to connect to database, mysqli function is called and an object is returned. In case database connection is ...