PHP 7.2.0 Beta 1 Released

mysqli_connect

(PHP 5)

mysqli_connectAlias dla mysqli::__construct()

Opis

Ta funkcja jest aliasem dla: mysqli::__construct()

add a note add a note

User Contributed Notes 5 notes

up
0
php dot net dot comments at siteaboutnothing dot com
10 days 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
0
zubkov dot rabota at gmail dot com
25 days ago
To set a permanent connection use prefix 'p:'
example:

"$pMysqli = new mysqli('p:'.DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);"
up
-3
thamizh82 at gmail dot com
6 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
-62
d4v3m0nk
9 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
-75
tuxedobob
9 months ago
When using this function rather than the OO syntax, this function will return FALSE on error, rather than an object.
To Top