Jump to content

Database not selected?


div

Recommended Posts

I have the database connection string as a seperate file (dbconnect.php) with the following (I've replaced the name, password and database names, obviously):

 

<?php

$dbh=mysql_connect ("localhost", "name", "password") or die ('I cannot connect to the database because: ' . mysql_error());

mysql_select_db ("database"); 

?>

 

 

But I keep getting "No database selected" when trying to login. I also get "I cannot add user. No database selected" when using the user creation form. I'm using two databases (one for my domain, one for the subdomain), the main one (on the domain) was not built by me, and the "password" section in THAT dbconnect file is just "password", and when I created the new database there wasn't any option to create a password, so I've just left it as "password" in the new dbconnect file.

 

I copy/pasted the database connection string from the control panel, so I'm surprised it won't work.

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.