Home  >  Article  >  Backend Development  >  Usage of mysqli_get_server_version() in PHP

Usage of mysqli_get_server_version() in PHP

angryTom
angryTomforward
2020-02-02 21:22:002556browse

This article introduces the definition and usage of the mysqli_get_server_version() method in PHP. I hope it will be helpful to friends who are learning MySQL and PHP!

Usage of mysqli_get_server_version() in PHP

Definition and Usage

The mysqli_get_server_version() function returns the MySQL server version as an integer.

MySQL server version will be returned in the following format: major version 10000 minor version 100 subversion. For example: 5.1.0 will return 50100.

Recommended related article tutorials: php tutorial

Grammar

mysqli_get_server_version(connection);

Examples

Return the MySQL server version as an integer:

<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检测连接
if (mysqli_connect_errno($con))
{
     echo "数据库连接失败: " . mysqli_connect_error();
}
echo mysqli_get_server_version($con);
mysqli_close($con);
?>

The above is the detailed content of Usage of mysqli_get_server_version() in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:51cto.com. If there is any infringement, please contact admin@php.cn delete