I need to copy data from a mssql database to a mysql database, i have modified a sript that worked on from mysql to mysql. I looks now like this:
<?php
$host = "ip";
$gnaam = "test";
$pass = "password";
//mssql database
$resource1 = mssql_connect("$host","$gnaam","$pass");
$db = mssql_select_db(PACS, $resource1)
or die ("Couldn't select database 1.");
//mysql database
$resource2 = mysql_connect(localhost,test2,password2);
$db = mysql_select_db(radinfo, $resource2)
or die ("Couldn't select database 2.");
//select query's mssql
$sql1 = "SELECT id as 'id' FROM test ORDER BY id"
$query1 = mssql_query($sql1, $resource1);
//insert to mysql
for ($i=0;$i<($result = mssql_fetch_assoc($query1));$i++) {
mysql_query("INSERT INTO test ('uid') VALUES('id,0,0,0,0,0') ($resource2");
}
mssql_close($resource1);
mysql_close($resource2);
?>
I haven't had the chance to test it yet, because I can,t use the mssql database yet.
And I was wondering if you can actually use mysql and mssql in the same php script? And is this scipt going to work? Or do I need to find another way?
And is there a diference in the SELECT, INSERT, ORDER BY, and AS statement in mssql and mysql?
Any help is welcome, Thanks.