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

<?php
echo “trying<br/>”;
$link = mysql_connect(’123.123.123.123′, ‘username’, ‘password’);
if (!$link) {
die(‘Could not connect: ‘ . mysql_error());
}
else
{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>