Quick PHP code to test mysql database connection

Just a quick snippet to test the mysql database connection can be seen and is working from PHP

echo “trying<br/>”;
$link = mysql_connect(’′, ‘username’, ‘password’);
if (!$link) {
die(‘Could not connect: ‘ . mysql_error());
{echo “connected”;}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>