Update remote mysql database from localhost by PHP- Is it posibble? is it safe?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to update my database on remote server in the way 
i can read data from database on localhost and transfare it to 
remote database.I have done that in this way but i didnt get any 
result.could any one tell me haw i can do it?

//-------local connection
$link = mysql_connect ("localhost", "localuser", "local password") 
or die ("I can't connect with DataBase :(");
mysql_select_db ("my local database") or die ("I'm connecting with 
Database Server On localhost but I can't select your DB.");

//-------remote connection
$link_server = mysql_connect 
("www.nyserver.com", "myuser", "mypass") or die ("I can't connect 
with DataBase :(");
mysql_select_db ("my database") or die ("I'm connecting with 
Database Server On shiasearch.com but I can't select your DB.");


$query="select id, text FROM test_update limit $min,1000";
$max = $min + 1000;
$result = mysql_query($query, $link);
$i = 0;
while ($row = mysql_fetch_array ($result)){
	   $i++;
	   $result2 = mysql_query($row[2], $link_server);
 
}//while		
	   echo "<a href=\"update.php?min=$max\">[$i records 
Updated] ---- NEXT</a>";



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux