How to connect with MySQL database using PHP
Connecting to MySQL database is very easy. To do this you have to follow some basic steps. Here are the steps:
- Create a connection for MySQL database
- Select the Database
- Close the Database
mysql_connect(serverName, serverUsername, ServerPassword)
We use Vertigo server. In Vertrigo server the serverName is localhost, the serverUsername is root and the serverPassword is vertrigo so we can write the function like this
mysql_connect(localhost, root, vertrigo)
Note: In ZAMMP server there are no password is needed so the server password could be null.
The real PHP code to connect with MySQL database like this
<?php
$serverName=”localhost”;
$serverUsername=”root”;
$serverPassword=”vertrigo”;
$create_connection=mysql_connect($serverName, $serverUsername, $serverPassword)
or die(“connection error with mysql database”);
?>
Comments
Post a Comment