Recently I need to convert a previous ASP website into PHP, but PHP is with mysql and my asp is with mssql. As a result, I need to import the mssql data into the mysql database. I wrote an example myself below and copied it. An example is not bad.
Example 1
The code is as follows
|
Copy code
|
||||||||
//Domestic PNR code connection $conn = mssql_connect($hostname,$dbuser,$dbpasswd); //Connect to MSSQL
$Airport=$Arr->Airport; $citycode=$Arr->citycode; $Chinesecityname=$Arr->Chinesecityname; $Chinesecityjp=$Arr->Chinesecityjp; $english=$Arr->english; $countrycode=$Arr->countrycode; $countryfullname=$Arr->countryfullname; $Chauname=$Arr->Chauname; //echo $code; $conn=mysql_connect("localhost","root","123456");//Account and port number to connect to the database mysql_query("SET NAMES ‘GBK’",$conn); mysql_select_db("taojipiao2009",$conn);//Load database //$sql="update internationcode set jp=’$aa’ where Code=’$Code’"; $sql="insert into internationcode(Airport,citycode,Chinesecityname,Chinesecityjp,english,countrycode,countryfullname,Chauname) values('$Airport','$citycode','$Chinesecityname','$Chinesecityjp','$english' ,'$countrycode','$countryfullname','$Chauname')"; //echo $sql." "; $result=mysql_query($sql); } //mssql_close($conn); //Close the database ?> Reference code 2,
source:php.cn
Previous article:How to change the MySQL password through phpmyadmin and solve the problem of phpmyadmin being unable to log in_PHP tutorial
Next article:Mysql transaction processing application example of pdo under php_PHP tutorial
Statement of this Website
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
Latest Articles by Author
Latest Issues
Group MySQL results by ID for looping over
I have a table with flight data in mysql. I'm writing a php code that will group and displ...
From 2024-04-06 17:27:56
0
1
406
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|