Tools, FAQ, Tutorials:
Connecting to a MySQL Server in PHP
How To Connect to MySQL from a PHP Script in PHP?
✍: FYIcenter.com
If you want access the MySQL server, you must create a connection object first by calling the mysql_connect() function in the following format:
$con = mysql_connect($server, $username, $password);
If you are connecting to a local MySQL server, you don't need to specify username and password. If you are connecting to a MySQL server offered by your Web hosting company, they will provide you the server name, username, and password.
The following script shows you how to connect to a local MySQL server, obtained server information, and closed the connection:
<?php $con = mysql_connect('localhost'); print(mysql_get_server_info($con)."\n"); print(mysql_get_host_info($con)."\n"); mysql_close($con); ?>
If you run this script, you will get something like this:
5.0.2-alpha localhost via TCP/IP
⇐ Information Needed for MySQL Connection in PHP
2016-10-20, 2298🔥, 0💬
Popular Posts:
Can Two Forms Be Nested? Can two forms be nested? The answer is no and yes: No. You can not nest two...
How to build a PHP script to dump Azure AD 2.0 Authentication Response? If you are use the Azure-AD-...
Why I am getting "The Windows SDK version 8.1 was not found" error, when building my C++ application...
Where to find tutorials on Using Azure API Management Publisher Dashboard? Here is a list of tutoria...
Where to get a real Atom XML example? You can follow this tutorial to get a real Atom XML example: 1...