Nov 8, 2009

Error 1046: No Database Selected

free web hosting
Open Discussion & Free Web Hosting > Astahost > Hosted Members Support > Misc. Issues with no other forum

Error 1046: No Database Selected

sid.calcutta
Thanks Astahost for providing me with FREE hosting support. However, as I am facing this problem,so, I need your help.

Whenever, I want to access my site ( MySQL-PHP Based), I get the following error message:

Error 1046: No Database Selected.


My connection string looks like:

CODE
$link_id = mysql_connect("localhost", "my_new_db_user_name", "my_new_db_password");


CODE
if(!$link_id) if(!$link_id)  error_message(sql_error());


followed by:

CODE
$current_db= mysql_select_db($db_name,$link_id);


Please note that:

My website runs smoothly in my local server without any error . Configuration of my local server is :
Apache 1.3.27(WIN32)/PHP 5.0.4 MySQL Server 4.1
Obviously, I have changed my db_name,db_user_name and db_password in the connection string for the webserver.


Webserver Information:

MySQL version 4.0.26-standard
PHP version 4.4.1


Thanks in anticipation of your reply.
Regards,
Sid



 

 

 


Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
I think that error was caused owing to MySQL overload. I received a bunch of emails from the server monitoring script informing me of a prolonged MySQL outage today. I'd advise you to try once again and let me know. Although this isn't a regular issue - you'll face it from time to time (at least once in two weeks) as our free servers are always under tremendous load.

Another issue you have to keep in mind is that, any MySQL Db you create here, will be prefixed with your cPanel login username.

Thus, if your cPanel login is: mylogin - and you create a DB named, mydb - that actual name of your database will be, mylogin_mydb. You've to include THIS name when you're using the mysql_select_db() function.

The same goes for your MySQL DB Username too - even that is prefixed by your cPanel login.

Comment/Reply (w/o sign-up)

sid.calcutta
I have been trying to access my website since last night and every time it gives the same error.
However, I have no problem in logging into my cPanel and administer my Database.
I have already included the name like mylogin_mydb in mysql_select_db() function infact in the last night . But since then, it is not working. Would you mind looking into this matter, I mean..., if possible. I am waiting for your reply.

Regards,
Sid.

*EDIT*
Yes, now it is running smoothly and I can access my website. Probably, as you have pointed out, it was due to MYSQL overload. And once again, the cPanel is wonderful. Thanks.

Regards
Sid.


Comment/Reply (w/o sign-up)

Houdini
You have the same statement twice in one code block
CODE
if(!$link_id) if(!$link_id)  error_message(sql_error());

try it with just one conditional statement
if(!$link_id) error_message(sql_error());
also do you have an error_message() function defined elsewhere? It is not a PHP function, the closet to what your code shows would be trigger_error(string error message[int error type])

Comment/Reply (w/o sign-up)

sid.calcutta
Yes, I have defined the function error_message() in a seperate file that stores all the connection information to my MySQL database . My source code was also correct. I copied it wrongfully here. Now I can access my website without making any change in the code. Probably, as pointed out earlier, it was due to MySQL overload.
However, thanks a lot for your reply.
Regards,
Sid



Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : error, 1046, database, selected

  1. Error Connecting To Domain
    (2)
  2. Mysql Storage Engine Error 28
    (5)
    Hello, On my website and forum, SDeckNET, the mySQL database is not working. I get the error "mySQL
    error: Got error 28 from storage engine mySQL error code: Date: Wednesday 02nd 2008f July 2008
    05:33:53 AM" from my forum. From what I know, error 28 means I'm out of disk space, how can this
    be? I was never told of a mySQL space limitation and all these cases of downtime are destroying my
    site's memberbase. EDIT: It now seems PhpMyAdmin is down too, with the error: "Warning:
    session_write_close() : SQLite: session write query failed: database is full in /usr/l....
  3. How To Move My Sites (files And Database) To Computing Host
    (I just bought a plan at Computing Host) (6)
    Finally, I bought a hosting plan at Computing Host. Now, I would like to know how to move all my
    files and databases to that hosting account from my present AstaHost account. Once that is done, I
    will change the nameservers to point to Computing Host nameserves in my domain control panel.
    /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Thanks in
    advance.....
  4. Hosting Termination Error
    (0)
    bakr_2k5 terminated his hosting account but still shows as HOSTED. I think he did this during the
    recent RED period. I tried to do a termination token for his account as well but still no luck.
    Can you ensure that his hosting is terminated and fix his member group. vujsa....
  5. This Error On This Site!
    (5)
    Many times i will click on a link and below is what I will get> QUOTE Board Message Sorry, an
    error occurred. If you are unsure on how to use a feature, or don't know why you got this error
    message, try looking through the help files for more information. The error returned was: Sorry,
    the link that brought you to this page seems to be out of date or broken. Useful Links Forgotten
    Password Recovery Register a new account Our help documentation Contact the forums administrator
    Why is there a link to it and why do I get this meanless message? If it is out....
  6. Email Not Working In Outlook
    Error message for sending (3)
    Hi, I keep getting the following messages when I'm sending under Outlook. CODE The
    connection to the server has failed. Account: 'tim@xnrmusic.astahost.com', Server:
    'mail.xnrmusic.astahost.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error:
    10061, Error Number: 0x800CCC0E Any ideas?....
  7. Send Mail Through Outlook Express
    Error - Connected / Won't Send (11)
    I have not been able to send mail through my e-mail account. I have my own domain and my current
    email settings are as follows: Incoming Mail: mail.vjgamer.com Outgoing Mail: mail.vjgamer.com
    Account Name: vjgamer (This is my default account/cPanel name.) Password: Same as my cPanel Password
    Outgoing Mail Server - My server requires authentication (Checked)         Settings... - Use same
    settings as incoming mail server I have checked my MX settings in my cPanel. It was set to
    vjgamer.com, so earlier today I changed it to mail.vjgamer.com. This did not work, I am ge....
  8. Get Server Timeout Error Msg
    i try to update my site with frontpage (0)


      Looking for error, 1046, database, selected

See Also,

*SIMILAR VIDEOS*
Searching Video's for error, 1046, database, selected
advertisement



Error 1046: No Database Selected

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com