Return the MySQL server version as an integer:
<?php$con=mysqli_connect("localhost","my_user","my_password","my_db");//Detect connection if (mysqli_connect_errno($con)) { echo "Database connection failed: " . mysqli_connect_error(); }echo mysqli_get_server_version($con);mysqli_close($con);?>The mysqli_get_server_version() function returns the MySQL server version as an integer.
The 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.
mysqli_get_server_version( connection ) ;
parameter | describe |
---|---|
connection | Required. Specifies the MySQL connection to use. |
Return value: | Returns an integer representing the MySQL server version. |
---|---|
PHP version: | 5+ |