|
Posted by Joachim Smit on 11/24/06 20:26
I want store data in 2 different database, just for backup. One database
is located at the webserver, the 2nd one on another server.
I've writte this little script to test it.
<?php
$db1 = pg_connect("host=123.123.123.123 dbname=test user=usrphp");
$cmd = "insert into website (ipnr, page) values ('777', 'main')";
$result = pg_query($db1, $cmd);
$db2 = pg_connect("dbname=test user=usrphp");
$cmd = "insert into website (ipnr, page) values ('777', 'main')";
$result = pg_query($db2, $cmd);
echo ($db1);
echo ("\n");
echo ($db2);
echo ("\n");
pg_close($db1);
pg_close($db2);
?>
When I call this script from the command prompt, I get the result:
Resource id #1
Resource id #3
and the data is written to both databases.
When I call the script with a browser from outside, I get the result:
Resource id #2
Data is written only to the local database.
Why ?
Many thanks in advance.
Joachim
Navigation:
[Reply to this message]
|