web 2.0

How to use PHP & MySQL Connect to Database

How to use PHP & MySQL Connect to Database Learn PHP how to using PHP connect to MySQL Database.

ShotDev Focus:
- Test a connect to MySQL Database

Example

php_mysql.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root");
if($objConnect)
{
echo "Database Connected.";
}
else
{
echo "Cannot Connect to MySQL = ".mysql_error();
}

mysql_close($objConnect);
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_mysql.php

Screenshot

PHP MySQL Connect to Database
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.