aikiDave Posted December 29, 2002 Share Posted December 29, 2002 Hello! I'm new to ***** Hosting (just got everything set up a couple of days ago, in fact) and I was wondering if anyone here might be able to help me out. I've some experience with Web design, but all of my database work has been with ASP. I'm learning a bit of how PHP works, but I keep having trouble accessing my database. I am told that, while I can connect to the server, it cannot find the database itself. Here's what I've been using: $dbh=@mysql_connect ("localhost", "db_user", "password") or die ('I cannot connect to the database because: ' . mysql_error()); if (!$dbh) { echo( "<p>Unable to connect to the " . "database server at this time.</p>" ); exit(); } mysql_select_db("db_",$dbh); if (!@mysql_select_db("db_") ) { echo( "<p>Unable to locate the db " . "database at this time.</p>" ); exit(); } Sorry if this goes beyond the scope of support, but I just thought I'd see if anyone could see what I was doing wrong. Many thanks! Quote Link to comment Share on other sites More sharing options...
Head Guru Posted December 29, 2002 Share Posted December 29, 2002 This might help Name of host - localhost Database Name - cpanelusername_dbname Datbase User Name - cpanelusername_dbusername Quote Link to comment Share on other sites More sharing options...
orangechicken Posted December 29, 2002 Share Posted December 29, 2002 If you go to your mysql manager in your cpanel it will display the PHP code necessary to connect to your database. It's very handy! -chicken Quote Link to comment Share on other sites More sharing options...
aikiDave Posted December 30, 2002 Author Share Posted December 30, 2002 Head Guru: Thanks very much! That was the information I needed! And I agree: the information provided that tells you how to connect to the database is very helpful. Although I will be happy to post something in the Reviews forum, I must say that I have been very impressed with the tools and service provided by Simple Net Hosting. I've been maintaining a colleague's Web site for some time now--I only wish I had had the tools and capabilities I have here! (Hm...maybe I should talk to him about moving over... you think?) Again, many thanks for the help! Quote Link to comment 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.