I have a SqlServer
database and need, via php script, to send the data from a table to a MySql database.
Will OPENQUERY result within the condition I have (php script)?
How best to do this?
The code I use to connect banks:
SqlServer:
$conMsSql = odbc_connect('Banco_MsSql','User_MsSql','Pw_MsSql');
MySql:
$hostname_mysql = "localhost";
$database_mysql = "banco_mysql";
$username_mysql = "user_mysql";
$password_mysql = "pw_mysql";
$Conn = mysql_pconnect($hostname_mysql, $username_mysql, $password_mysql) or trigger_error(mysql_error(),E_USER_ERROR);
$DBase = mysql_select_db($database_mysql,$Conn) or die(mysql_error());
And it would look something like this:
$query = mysql_query('insert into tabela1 ( col1, col2, col3 )
select sqlserver.tab1.col1, sqlserver.tab1.col2, sqlserver.tab1.col3 from sqlserver.tab1')