Im using this php code to see if I can connect to my database.
$username="fixmy1_luke";
$password="xxx";
$server="localhost";
$database="fixmy1_shores-rentals";
$db_handle = mysql_connect($server, $username, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
print "Database Found " . $db_handle;
}
else {
print "Database NOT Found " . $db_handle;
}
at
http://fixmysite.us/shores-classified/rentals.php
What does that mean? is it an error?
thanks
Try this:
$username="fixmy1_luke";
$password="xxx";
$server="localhost";
$database="fixmy1_shores-rentals";
$db_handle = mysql_connect($server, $username, $password);
echo '<br />';
var_dump($db_handle);
# is connection OK?
if($db_handle)
{
$db_found = mysql_select_db($database, $db_handle);
echo '<br />';
$var_dump($db_found);
echo '<br />';
if ($db_found)
{
print "Database Found " .$db_found; // $db_handle;
}
else
{
print "Database NOT Found " .$db_found; // $db_handle;
}
}
else
{
echo '<br />';
echo 'Unable to connect to the dtabase';
}
Your message states that a mysql_connect(…) connection resource was found but it looks like the database name is incorrect.