Home >Backend Development >PHP Tutorial >PHP import mssql data and convert mysql database_PHP tutorial

PHP import mssql data and convert mysql database_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:05:04985browse

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
*/

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630821.htmlTechArticlephp To import and convert mssql data to mysql database, you need to understand how we import mssql server data to mysql. For databases, you must first install mssql server on your machine...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn