diff --git a/reference/mysqli/mysqli/real-connect.xml b/reference/mysqli/mysqli/real-connect.xml index 2ad98c95dad5..d220aa2678f4 100644 --- a/reference/mysqli/mysqli/real-connect.xml +++ b/reference/mysqli/mysqli/real-connect.xml @@ -4,7 +4,7 @@ mysqli::real_connect mysqli_real_connect - Opens a connection to a mysql server + Opens a connection to the MySQL server @@ -33,7 +33,8 @@ intflags0 - Establish a connection to a MySQL database engine. + Opens a connection to the MySQL database server + with optional connection options. This function differs from mysqli_connect: @@ -42,13 +43,7 @@ mysqli_real_connect needs a valid object which has - to be created by function mysqli_init. - - - - - With the mysqli_options function you can set various - options for connection. + to be created by mysqli_init. @@ -151,7 +146,7 @@ MYSQLI_CLIENT_FOUND_ROWS - return number of matched rows, not the number of affected rows + Return the number of matched rows, not the number of affected rows MYSQLI_CLIENT_IGNORE_SPACE @@ -236,28 +231,15 @@ options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) { - die('Setting MYSQLI_INIT_COMMAND failed'); -} - -if (!$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) { - die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed'); -} +$mysqli->options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0'); +$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5); -if (!$mysqli->real_connect('localhost', 'my_user', 'my_password', 'my_db')) { - die('Connect Error (' . mysqli_connect_errno() . ') ' - . mysqli_connect_error()); -} +$mysqli->real_connect('localhost', 'my_user', 'my_password', 'my_db', null, null, MYSQLI_CLIENT_COMPRESS|MYSQLI_CLIENT_FOUND_ROWS); echo 'Success... ' . $mysqli->host_info . "\n"; - -$mysqli->close(); -?> ]]> &style.oop; when extending mysqli class @@ -266,30 +248,20 @@ $mysqli->close(); host_info . "\n"; - -$db->close(); -?> ]]> &style.procedural; @@ -297,28 +269,15 @@ $db->close(); ]]> &examples.outputs;