|
List Info
Thread: Update remote mysql database from localhost by PHP- Is it posibble? is it safe?
|
|
| Update remote mysql database from
localhost by PHP- Is it posibble? is it
safe? |
  United States |
2008-03-05 02:55:15 |
|
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>";
__._,_.___
.
__,_._,___
|
| RE: Update remote mysql database from
localhost by PHP- Is it posibble? is it
safe? |
  United States |
2008-03-05 16:12:44 |
|
> 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>";
It's difficult to tell what you want to do, but first thing I notices is
this line: $result2 = mysql_query($row[2], $link_server);
1. You are getting 2 fields and fetching as an array, so $row[2] will be
empty.
2. it looks like you are trying to execute some field (from you local
server) as a query on a remote server. Is that right?
-D. Israel
dan%40ebji.org">dan ebji.org
http://www.customcodebydan.com
AIM: JudoDanIzz
A BANDAID!? Damn it Jim,I'm a doctor,not a-oh, never mind
> -----Original Message-----
> From: alireza_353 [mailto: alireza_353%40yahoo.com">alireza_353 yahoo.com]
> Sent: Wednesday, March 05, 2008 12:55 AM
> To: php-objects%40yahoogroups.com">php-objects yahoogroups.com
> Subject: [php-objects] Update remote mysql database from localhost by
> PHP- Is it posibble? is it safe?
>
> 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>";
>
>
>
>
> Are you looking for a PHP job? Join the PHP Professionals directory
> Now!
> http://www.phpclasses.org/professionals/
> Yahoo! Groups Links
>
>
>
__._,_.___
.
__,_._,___
|
| Update remote mysql database from
localhost by PHP- Is it posibble? is it
safe? |
  United States |
2008-03-05 17:02:21 |
|
>> 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?
Unless you have done something "special", you can usually only read and
write to a database on the same server as the PHP page which is doing
the reading and writing, for security reasons.
The normal way to transfer the data is to create a .sql file, and use
that.
--
Pete Clark
Sunny Andalucia
http://hotcosta.com/Andalucia.Spain
__._,_.___
.
__,_._,___
|
| RE: Update remote mysql database from
localhost by PHP- Is it posibble? is it
safe? |
  United Kingdom |
2008-03-06 04:26:40 |
|
I'm not sure which O/S Pete is referring to here, but there's no technical
reason why you can't use multiple databases spread over as many servers you
want.
In fact, I use MySQL databases (plus others) on at least 3 platforms, all
accessed by the same script, to pull data in from multiple sources. If you
want database horizontal saleability, you'll _have_ to start using multiple
servers.
Having said all this, you still need to consider security, latency, and
design. Why is the data on another server. Is the path to the server secure.
Should the data be there. Could is be copied overnight, etc, etc.
Rob.
-----Original Message-----
From: php-objects%40yahoogroups.com">php-objects yahoogroups.com [mailto: php-objects%40yahoogroups.com">php-objects yahoogroups.com] On
Behalf Of Pete
Sent: 05 March 2008 23:02
To: php-objects%40yahoogroups.com">php-objects yahoogroups.com
Subject: [php-objects] Update remote mysql database from localhost by PHP- Is
it posibble? is it safe?
>> 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?
Unless you have done something "special", you can usually only read and
write to a database on the same server as the PHP page which is doing
the reading and writing, for security reasons.
The normal way to transfer the data is to create a .sql file, and use
that.
--
Pete Clark
***********************************************************************************
Any opinions expressed in email are those of the individual and not necessarily those of the company. This email and any files transmitted with it are confidential and solely for the use of the intended recipient
or entity to whom they are addressed. It may contain material protected by attorney-client privilege. If you are not the intended recipient, or a person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use is strictly prohibited.
Random House Group + 44 (0) 20 7840 8400
http://www.randomhouse.co.uk
http://www.booksattransworld.co.uk
http://www.kidsatrandomhouse.co.uk
Generic email address - enquiries%40randomhouse.co.uk">enquiries randomhouse.co.uk
Name & Registered Office:
THE RANDOM HOUSE GROUP LIMITED
20 VAUXHALL BRIDGE ROAD
LONDON
SW1V 2SA
Random House Group Ltd is registered in the United Kingdom with company No. 00954009, VAT number 102838980
***********************************************************************************
__._,_.___
.
__,_._,___
|
| Update remote mysql database from
localhost by PHP- Is it posibble? is it
safe? |
  United States |
2008-03-07 05:37:30 |
|
In message <C2C319C4C1CC7D46B2D7815BE3A2753E03CEC8C4 coxsrv-
3.uk.randomhouse.com>, Atkinson, Robert < ratkinson%40tbs-ltd.co.uk">ratkinson tbs-ltd.co.uk> writes
>I'm not sure which O/S Pete is referring to here, but there's no technical
>reason why you can't use multiple databases spread over as many servers you
>want.
My hosting company won't allow it, you would have to write special
gateway scripts.
--
Pete Clark
Sunny Andalucia
http://hotcosta.com/Andalucia.Spain
__._,_.___
.
__,_._,___
|
[1-5]
|
|