Connecting to a MySQL Server in PHP
How To Connect to MySQL from a PHP Script in PHP?
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
2016-10-20, 1065👍, 0💬
What is EPUB 2.0 Metadata "dc:subject" Element? EPUB 2.0 Metadata "dc:subject" is an optional metada...
How to view EPUB 2.0 metadata in Calibre book Library? You can follow this tutorial to view EPUB 2.0...
How to see more EPUB 2.0 metadata list with Calibre? You can follow this tutorial to view EPUB 2.0 m...
Where to find tutorials on how to use PHP built-in functions to manage arrays? A collection of tutor...
How To Use an Array as a Stack in PHP? A stack is a simple data structure that manages data elements...