Example 20.127.
Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print protocol version */
printf("Protocol version: %d\n", $mysqli->protocol_version);
/* close connection */
$mysqli->close();
?>
Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print protocol version */
printf("Protocol version: %d\n", mysqli_get_proto_info($link));
/* close connection */
mysqli_close($link);
?>
The above examples will output:
Protocol version: 10
See Also
mysqli_get_host_info
20.7.3.9.25. mysqli::$server_info,
Copyright 1997-2012 the PHP Documentation Group. [2230]
•
mysqli::$server_info
mysqli_get_server_info
Returns the version of the MySQL server
Description
Object oriented style
MySQL Improved Extension (Mysqli)
$mysqli->protocol_version
mysqli_get_server_info
example
2383
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers