Home > Article > Backend Development > PHP import mssql data and convert mysql database_PHP tutorial
php import mssql data and convert mysql database On the home page, you need to understand how we import mssql server data into mysql database. First, you must install mssql server 2000 on your machine, and at the same time, you must also make your machine support php+apache+mysql or php+iis+ mysql, okay, once we have these, we can start importing data.
php tutorial import mssql data and convert mysql tutorial database tutorial
On the home page, you need to understand how we import mssql server data into mysql database. First, you must install mssql server 2000 on your machine, and at the same time, you must also make your machine support php+apache+mysql or php+iis+ mysql, okay, once we have these, we can start importing data.
*/
//mssql server and php connection
$mcn = mssql_connect('127.0.0.1','sa','1');
mssql_select_db('hb',$mcn);
//mysql database connection
$conn = mysql_connect('localhost','root','a') or die('mysql server connection failed');
mysql_select_db('sa',$conn);
$mssql = "select * from bc ";
$msquery = mssql_query( $mssql ); //Query the data of mssql server and save it to data
if( mssql_num_rows( $msquery ) )
{
while( $rs = mssql_fetch_array( $msquery ) )
{
$mysql ="insert into vv(id,title) values('$rs[id]','$rs[title]')"; //mysql query statement
Mysql_query($mysql);//Save the data of mssql server to mysql database
}
}
else
{
echo 'mssql server has no data';
}
/*
Ok, it’s finally completed. In fact, the method is very simple, which is to connect two databases at the same time, then read the mssql data and save it to the data, and then save it one by one to the mysql database.
Original articles on this site indicate the source www.bKjia.c0m/phper/php.html
*/