Ok so I have a client that is trying to move half his site to another server...in this i still need to pull data from both databases. SO i have the new site and i need to do a mysql db query on the old site so i can include the old nav....but when i do
<?php include("http://www.othersite.com/includes/db.php"); ?>
<?php include("http://www.othersite.com/includes/nav.php"); ?>
I get
Warning: mysql_query(): Access denied for user 'www-data'@'localhost'
(using password: NO) in /vol/www/othersite.com/public_html/includes/nav.php
on line 223 Warning:
How do i access another db from the new site and not allow it to interfere with the new db connection
You'd need to show us the actual code used to connect to these dataases (with passwords blanked out). But even without it I can tell you that the remote server is NOT called
localhost
.It seems you're including these files from the remote site. It won't work this way, since the code is still executed on local server.
You must also make sure, that the remote MySQL allows remote connections, and that there is a MySQL user account with appropriate privileges created.
See: http://dev.mysql.com/doc/refman/5.5/en/privilege-system.html