Showing posts with label How to connect PHP with Database. Show all posts
Showing posts with label How to connect PHP with Database. Show all posts

How to connect PHP with Database

How to connect PHP with Database : 

Here is basic syntax:
1mysql_connect(host name, user name, password)  


Mysql_connect() will get the correct value if it is succeed but false if it is fail. Example:

<?

//the example of MySQL database connection

//connect.php

$continued = mysql_connect("localhost","root","admin");

if ($continued) {

   echo ("Connection is succeed")

} else {

    echo ("Connection is fail")

}

?>