Forum PHP 2017

mysqli_connect

(PHP 5, PHP 7)

mysqli_connectAlias de mysqli::__construct()

Description

Cette fonction est un alias de : mysqli::__construct()

add a note add a note

User Contributed Notes 3 notes

up
-5
thamizh82 at gmail dot com
5 months ago
$con=mysqli_connect("localhost","my_user","my_password","my_db");

var_dump($con);  -> Return mysql object.

$conn = mysqli_connect(NULL, $user, $pass);
$conn = mysqli_connect('NULL', $user, $pass);
Return Same object given before. Not thrown false or error.

$conn = mysqli_connect('NULLTest', $user, $pass);
Return false
up
-61
d4v3m0nk
8 months ago
Worthwhile noting that the MySQLi library can still open a permanent connection, but a different command isn't used. Simply prepend "p:" to the MySQL hostname or address.

Using classes:
$this->mysqli = new mysqli('p:'. mysql_host, mysql_user, mysql_password, mysql_database);

Using command:
$link = mysqli_connect('p:mysql_host', 'mysql_user', 'mysql_password', 'mysql_database');
up
-68
tuxedobob
8 months ago
When using this function rather than the OO syntax, this function will return FALSE on error, rather than an object.
To Top