tags:

views:

560

answers:

4

Hello,

I am using LAMP on localhost. I can login which uses mysql db, get to the main page (data driven), but when i enter this particular page, its fine, but when i refresh the error is "No Database Selected" then one every page says so.

I restarted the Apache, MySQL server

Browsers FF,IE, Chrome all show the same errors, cleared cache too. At the same time other websites that use the same LAMP server works fine.

Now thats strange

All ideas are welcome.

A: 

Are the main pages using mysql_select_db("foo") and this particular one not?

Ólafur Waage
linked to the connection string page
what's linked to the connection string page?
altCognito
sorry yes they all have and this particular too, assuming this particular didnt have,then the others should load properly
You can see what files are included with get_included_files() http://is.php.net/manual/en/function.get-included-files.php
Ólafur Waage
connection page contains$hostname_data = "";$database_data = "";$username_data = "";$password_data = "";$data = mysql_pconnect($hostname_data, $username_data, $password_data) or trigger_error(mysql_error(),E_USER_ERROR)
I saw you have this: mysql_select_db($database_mblogging, $mblogging); Is $mblogging a resource and does $database_mblogging contain a table name?
Ólafur Waage
that is a string from the connection string. just ignore that, i removed it for less confusion
But does $mblogging have a resource behind it to select the database?
Ólafur Waage
yes it does have
A: 

When you are connecting with php, you are not selecting a database (or the select is failing). Is it perhaps using a variable which is not getting properly populated?

altCognito
but how will that effect the other pages
A: 

Somewhere in the code (PHP) the default database gets reset, probably on a shared database connection. I guess this is a bug in the product you use.

Daniel Schneller
could you brief on that a little more
A: 

Try going through the code where it connects with database and tries to pull the data. Most of the times there is a configuration file which defines the connection attributes like username, password, database server, port and database to be used also.

for example in phpMyAdmin keeps the information in libraries/Config.class.php file.

TheVillageIdiot
<pre>mysql_select_db($database_mblogging, $mblogging);$query_Recordset1 = "SELECT * FROM table";$Recordset1 = mysql_query($query_Recordset1, $mblogging) or die(mysql_error());$row_Recordset1 = mysql_fetch_assoc($Recordset1);do {<span>Id:</span><span>echo $row_Recordset['id']</span>} while ($row_$Recordset = mysql_fetch_assoc($Recordset1)); </pre>Thats all...Once the error pops up, No other pages loads