The mysqli_get_proto_info() function returns the MySQL protocol version.
Object oriented style
string $mysqli->protocol_version;
Procedural style
int mysqli_get_proto_info ( mysqli $link )
Parameter | Is required | Description |
---|---|---|
connection | Required. | MySQL connection |
The mysqli_get_proto_info() function returns the MySQL protocol version.
The following code gets the MySQL protocol version.
<?php/*from www .j a va2s .c om*/
$con=mysqli_connect("localhost","my_user","my_password","my_db");
if (mysqli_connect_errno($con)){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
echo mysqli_get_proto_info($con);
mysqli_close($con);
?>
Object oriented style
<?php/* w ww.ja va2s . c o m*/
$mysqli = new mysqli("localhost", "my_user", "my_password");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
print $mysqli->protocol_version;
$mysqli->close();
?>