mysqli_connect

(PHP 5, PHP 7)

mysqli_connectAlias von mysqli::__construct()

Beschreibung

Diese Funktion ist ein Alias für: mysqli::__construct()

add a note add a note

User Contributed Notes 5 notes

up
2
zubkov dot rabota at gmail dot com
5 months ago
To set a permanent connection use prefix 'p:'
example:

"$pMysqli = new mysqli('p:'.DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);"
up
-17
thamizh82 at gmail dot com
10 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
-10
php dot net dot comments at siteaboutnothing dot com
5 months ago
By default port 3306 will be used.

To use a different port, enter it as another argument, not as part of the hostname:

mysqli_connect($db_host,$db_user,$db_pass,$db_database,$db_port);
up
-64
d4v3m0nk
1 year 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
-80
tuxedobob
1 year ago
When using this function rather than the OO syntax, this function will return FALSE on error, rather than an object.
To Top