PHP : mysql_get_server_info() function
Description
The mysql_get_server_info() is used to get MySQL server information.
Version
(PHP 4 and above)
Syntax
mysql_get_server_info(connection)
Parameter
| Name | Description | Required/ Optional | Type |
|---|---|---|---|
| connection | The MySQL connection. Before performing any operation on a MySQL database, it is required to set a connection to the mysql database you want to work with. And this is done by mysql_connect() function. This function takes three parameters, name of the host, username with which you want to perform tasks with the mysql database in question, and password of that user. As soon as a successful connection is established, you can perform the operations on that mysql database. In case, no such connection is found, it will try to create one without any arguments, i.e. mysql_connect() without any parameters. If it fails to connect to a mysql database, it will generate a warning (E_WARNING) but not an error. | Optional | Resource |
Return value
The MySQL server version on success, or FALSE on failure.
Value Type : String.
Example :
<?php
$con = mysql_connect("localhost", "root", "mypass");
echo "MySQL server info : ".mysql_get_server_info();
?>
Output :
MySQL server info : 5.0.51a-community-nt
Note
Depending upon the MySQL version installed on your machine, your output may vary.
See also

