I have a form where the user enters their database information and can click a link that uses AJAX to send the credentials to this page. The problem I have is that as long as they enter the correct host name the script returns TRUE.
Is there another way to test this so that it will return FALSE if the username and password are not valid?
$h = urldecode($_GET['h']);
$u = urldecode($_GET['u']);
$p = urldecode($_GET['p']);
$con = mysql_connect($h, $u, $p);
if(!$con){
echo 'Could not connect';
}
else{
echo 'Connected';
}
Solved!
For future reference, the issue was that there where entries in the mysql user table for user = "Any". I removed those users and the script worked as expected. I updated this post to include a screen shot for anyone having similar problems. Thanks to Fabio below for the suggestion!

falseis to be returned if the connection fails. Maybe the SQL server you are trying this with is misconfigured to accept any connection? Have you tried with another mySQL server?