Easy Tutorial
❮ Func Filesystem Is Readable Func Mysqli Next Result ❯

PHP mysqli_real_connect() Function

PHP MySQLi Reference Manual

Example

Open a new connection to the MySQL server:


Definition and Usage

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

The mysqli_real_connect() function differs from the mysqli_connect() function in the following ways:


Syntax

Parameter Description
connection Required. Specifies the MySQL connection to use.
host Optional. Specifies a host name or IP address.
username Optional. Specifies the MySQL username.
password Optional. Specifies the MySQL password.
dbname Optional. Specifies the default database to be used.
port Optional. Specifies the port number to attempt to connect to the MySQL server.
socket Optional. Specifies the socket or named pipe to be used.
flag Optional. Specifies different connection options. Possible values: <br> MYSQLI_CLIENT_COMPRESS - Use compression protocol <br> MYSQLI_CLIENT_FOUND_ROWS - Return the number of matched rows (not the number of affected rows) <br> MYSQLI_CLIENT_IGNORE_SPACE - Allow spaces after function names, making them reserved words <br> MYSQLI_CLIENT_INTERACTIVE - Allow interactive_timeout seconds of inactivity before closing the connection <br> MYSQLI_CLIENT_SSL - Use SSL encryption

Technical Details

Return Value: Returns TRUE on success, FALSE on failure.
PHP Version: 5+
--- ---
❮ Func Filesystem Is Readable Func Mysqli Next Result ❯