Dear All,
I am having 2 different DB on 2 different hosts.
I am running MySQL Server on my local PC where the user is entering data in the tables. I have a website which has the identical DB on the web. I am able to connect to the database by using the codes on the server.
I want to update the server DB with the local system DB by running one update command. I get the error "-SELECT command denied to user 'localusername'@'localhost' for table 'pst_data'"
Given below is the code used for the process :
//connecting the remote system DB
$link = mysql_connect('IPAddress:3306', 'remoteusername', 'Password');
if (!$link) {
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db('remotedb', $link);
if (!$db_selected) {
die ('Can\'t use Remote System DB: ' . mysql_error());
}
//connecting the local database on the webstite
$weblink = mysql_connect("localhost","localusername","password");
if (!$weblink) {
die('Not connected : ' . mysql_error());
}
$webdb_selected = mysql_select_db('localwebdb', $weblink);
if (!$webdb_selected) {
die ('Can\'t use WebServer Database : ' . mysql_error());
}
//query to fetch the records from remote ystem and insert into local website database
$upd_Query=mysql_query("INSERT INTO localwebdb.`table` SELECT * FROM remotedb.`table` where field=' some condition' ");
---------------------------------------------------
I have tested that I have connected the remote DB by running queries on the webserver.
Could anyone bail me out so that i can copy the DB from remote to local
Any help would be appreciated