PHP mysqli_connect() Function

The mysqli_connect() function opens a new connection to the MySQL server.

This function is an alias of: mysqli::__construct()

Although the mysqli::__construct() documentation also includes procedural examples that use the mysqli_connect() function, here is a short example:

Example -

The above examples will output:

Success: A proper connection to MySQL was made! The my_db database is great. Host information: localhost via TCP/IP