|
|
|
|
![]() ![]() |
Mar 5 2006, 05:50 PM
Post
#1
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Validating Posts: 111 Joined: 28-January 06 Member No.: 10,917 |
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 |
|
|
|
Mar 5 2006, 06:13 PM
Post
#2
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 |
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. |
|
|
|
Mar 5 2006, 06:52 PM
Post
#3
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Validating Posts: 111 Joined: 28-January 06 Member No.: 10,917 |
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. This post has been edited by sid.calcutta: Mar 6 2006, 07:11 PM |
|
|
|
Mar 6 2006, 07:05 PM
Post
#4
|
|
|
Super Member Group: Members Posts: 572 Joined: 25-April 05 From: Nashville Tennessee Member No.: 4,340 |
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]) |
|
|
|
Mar 6 2006, 07:24 PM
Post
#5
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Validating Posts: 111 Joined: 28-January 06 Member No.: 10,917 |
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 |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 7th October 2008 - 01:33 AM |