Open notepad write the below code and save it as phpconnection.php in the Root Directory of your Apache server.
<?php
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{
echo "Congrats! connection established successfully";
}
mysql_close($con);
?>
in the above example mysql_error() function shows the error details on the webpage
Note : change the localhost, root and password as per your requirements..
0 comments:
Post a Comment