adamdavis Posted August 24, 2009 Share Posted August 24, 2009 edit: Sorry, forgot to include MySQL Version Info: "MySQL client version: 3.23.49" Hello. I will preface this with the fact that I have very limited MySQL experience. Right now I am simply trying to be able to login to my database and run queries via PHP. However when I do so i am receiving the following error message; Could not connect to the database: connect failed The Code which i am using is pasted below; test.php <?php require_once('db_login.php'); require_once('DB.php'); $connection = DB::connect("mysql://$db_username:$db_password@$db_host/$db_database"); if (DB::isError($connection)){ die ("Could not connect to the database: <br />". DB::errorMessage($connection)); } $query = "DROP TABLE purchases"; $result = $connection->query($query); if (DB::isError($result)){ die("Could not query the database: <br />". $query." ".DB::errorMessage($result)); } echo "Table dropped successfully!"; $connection->disconnect( ); ?> I have verified that the login information include in my db_login.php allows me to login to PHPadmin where i can view / modify the database, so i assume this information should also be good for use in my php files to access MySQL. Any help / suggestions you may be able to provide will be appreciated, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/171668-mysql-connection-issues/ Share on other sites More sharing options...
adamdavis Posted August 24, 2009 Author Share Posted August 24, 2009 followup: Appears that this issues are related to things on the hosts' end. I am hoping i'll be able to resolve it through correspondence with them, thanks to anyone who considered helping Quote Link to comment https://forums.phpfreaks.com/topic/171668-mysql-connection-issues/#findComment-905298 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.