Hi there guys,
Very sorry to bother you with this, but my ignorance concerning db hosts has forced my hand.
Sometimes, users of one of my scripts complain that they're having a problem with the script connecting to the db. They assure me that the info is correct. Up to this point, I've stated my inability to help them due to the connection's straightfowardness(it either works or it doesn't), but would really like to be able to say "Well, it found that database, but it's not accepting the password" or "the host is accepting the connection but there is no db with that name".
Here is my current connection script:
//Database/Mysql//
$dusername = "db_user"; //username to connect to database
$dpwd = "db_password"; //password to accecss mySQL
$dhost = "localhost"; //your db host usually localhost
$dbname = "db_name"; //db name to be accessed
$prefix = "auto_"; //prefix used in database
$autoconn = mysql_connect("$dhost","$dusername","$dpwd") or die ("DBUser or DBPass was refused when attempting to connect to MySQL Host.");
$dbi=mysql_select_db($dbname,$autoconn) or die("Unable to make master connection to database from the config file!" . mysql_error());
You can see how I segregated the host and the selection of the database, but is there a better method of detailing the connection process for troubleshooting process?
Barring customization of my script, is there a small snippet that people use to test db connections?
thanks,
json