If I'd like to update 2 similar tables on 2 completely different databases with the same data. Am I able to have 2 separate database connections on a page, without causing a fuss with the php?
<?php
// DB1
$connection = @mysql_connect("localhost", "user", "password");
$db_name = "database1";
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
// DB2
$connection = @mysql_connect("localhost", "user2", "password2");
$db_name = "database2";
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
// DB1
$sql1= "INSERT INTO table1(column1) VALUES ('$column1')";
mysql_query($sql1,$connection) or die(mysql_error());
// DB2 (exact same table structure as above)
$sql2= "INSERT INTO table1(column1) VALUES ('$column1')";
mysql_query($sql2,$connection) or die(mysql_error());
?>
I imagine that it can be done, but something must distinguish the DB differences for any queries I have. Any clarification is appreciated.