How To Connect to MySQL from a PHP Script
How To Connect to MySQL from a PHP Script? - PHP Script Tips - Working with MySQL Database
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
2007-04-18, 4245👍, 0💬
What are the core functionalities in XML .NET framework? Can you explain in detail those functionali...
Can we get a strongly typed resource class rather than using resource manager? In the previous quest...
Can two catch blocks be executed? No, once the proper catch section is executed the control goes fin...
What is hashing? To hash means to grind up, and that's essentially what hashing is all about. The he...
How can I show HTML examples without them being interpreted as part of my document? Within the HTML ...