I have 2 separate DB's one is on MSSQL and the other is on MySQL. I was wondering if there was a PHP way to copy about 25,000 records (contaning only 3 fields) from one to the other?
Currently I'm able to connect to MSSQL and create an array that contains the 25,000 records. If I echo my $array I get a page full of comma separated values. Nice and neat. (just the way I set it up )
What I can't seem to do is get is the array to dump into mysql.
Now please tell me if this is something I shouldn't even be doing because the number of records. I wasn't sure when I started if this was going to work. I've been exporting a CSV using Excel and Query. Then just importing into MySQL from phpmyadmin. Very time consuming considering it has to be done multiple times a day.
Here is my code that doesn't work (except for the MSSQL part works fine).
<?php
//Selecting all WADOCO, WALITM and WADL01 records
$dbserver="removed";
$dbuser="removed";
$dbpass="removed";
$dbname="PD_Repository";
$dbconn=mssql_connect($dbserver,$dbuser,$dbpass);
mssql_select_db($dbname, $dbconn) or die("Unable to Open The Database");
$query="SELECT F4801.WADOCO, F4801.WALITM, F4801.WADL01
FROM PD_Repository.PRODDTA.F4801 F4801
ORDER BY F4801.WADOCO";
$qt=mssql_query($query);
while($nt=mssql_fetch_array($qt)){
echo "$nt[WADOCO], $nt[WALITM], $nt[WADL01]";
echo "<br>";
}
$mydbserver="removed";
$mydbuser="removed";
$mydbpass="removed";
$mydbname="jdewo";
$mydbconn=mysql_connect($mydbserver,$mydbuser,$mydbpass);
mysql_select_db($mydbname, $mydbconn) or die("Unable to Open The Database");
mysql_query("INSERT INTO workorders(WADOCO, WALITM, WADL01) VALUES('".$nt[WADOCO]."', '".$nt[WALITM]."','".$nt[WADL01]."') ");
mssql_close($dbconn);
mysql_close($mydbconn);
?>
I can't get this to insert anything into the DB. Can anyone assist me on this? Thx!