Jump to content

Sql/php Question


aikiDave

Recommended Posts

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...