How to connect PHP with Database :
Here is basic syntax:
Mysql_connect() will get the correct value if it is succeed but false if it is fail. Example:
Here is basic syntax:
1 | mysql_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") |
| } |
| ?> |