Database access issues
Posted: Thu Aug 10, 2006 1:52 am
I have a php/mysql site which works fine locally, but no longer works completely on my remotely hosted server.
On four pages, a query runs to extract db information. This displays correctly. On this page, one should be able to click on a name or photo and then another query is run and a new page is opened displaying the results from another query. However, I get the following message when I make the appropriate click:
If access was denied to this user, the other four pages would not work, but they do; they all use the same database. I have created new users, altered access rights and I still get the same error message. I am stumped completely; I do not understand how access is allowed for some pages, but not for another.
The php access include file is:
The chunk of code on each of the relevant pages to access the php include is:
*Names changed.
As I said, the site had worked fine. I then uploaded some files which worked ok locally (but needed tweaking 'live'), and on the same day the host server 'had problems' with php file security. I assume that this problem is of my making, but as I know that other sites on this server had php pages hacked, I'm not sure that the files that I uploaded are the cause. I have now changed hosting company.
I'd be grateful if somebody could point me in the right direction as I've spent many hours seaching forums and manuals but can't get to the bottom of it, and would like to know how access rights can be fine for one page but not another.
On four pages, a query runs to extract db information. This displays correctly. On this page, one should be able to click on a name or photo and then another query is run and a new page is opened displaying the results from another query. However, I get the following message when I make the appropriate click:
Code: Select all
Access denied for user 'user'@'localhost' to database 'databasename'The php access include file is:
Code: Select all
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_dbConnect = "localhost";
$database_dbConnect = "databasename";
$username_dbConnect = "user";
$password_dbConnect = "password";
$dbConnect = mysql_connect ($hostname_dbConnect, $username_dbConnect, $password_dbConnect) or trigger_error(mysql_error(),E_USER_ERROR);
?>Code: Select all
<?php require_once('dbconnect.php');
mysql_select_db($database_dbConnect, $dbConnect);As I said, the site had worked fine. I then uploaded some files which worked ok locally (but needed tweaking 'live'), and on the same day the host server 'had problems' with php file security. I assume that this problem is of my making, but as I know that other sites on this server had php pages hacked, I'm not sure that the files that I uploaded are the cause. I have now changed hosting company.
I'd be grateful if somebody could point me in the right direction as I've spent many hours seaching forums and manuals but can't get to the bottom of it, and would like to know how access rights can be fine for one page but not another.