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, 4528👍, 0💬
How do we create DCOM object in VB6? Using the CreateObject method you can create a DCOM object. You...
What is the benefit of using #define to declare a constant? Using the #define method of declaring a ...
What is Shell scripting A shell script is a script written for the shell, or command line interprete...
Can you explain in brief how can we implement threading ? Private Sub Form1_Load(ByVal sender As Sys...
What is difference between ADPATCH and OPATCH ? # ADPATCH is utility to apply ORACLE application Pat...