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

Usage of mysqli_get_server_version() in PHP

angryTom
Release: 2023-04-08 12:16:01
forward
2700 people have browsed it

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);
Copy after login

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);
?>
Copy after login

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!

Related labels:
source:51cto.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template