<?php PNR code connection in China $hostname = "127.0.0.1"; The IP address of the MSSQL server or the name of the server $dbuser = "sa"; The account number of the MSSQL server $DBPASSWD = "sa"; The password for the MSSQL server $dbname = "AA"; Name of the database $conn = Mssql_connect ($hostname, $dbuser, $DBPASSWD); Connecting MSSQL mssql_select_db ($dbname); /* Connection to access the database can also be written here $db =mssql_select_db ($dbname, $conn); */ $sql = "SELECT * from sheet1$"; SQL statement $data = Mssql_query ($sql); Set the value of the query in the variable $data while ($ARR = Mssql_fetch_object ($data))//loop initial set $arr { $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");//Connect the database's account number and port number mysql_query ("SET NAMES ' GBK '", $conn); mysql_select_db ("taojipiao2009", $conn);//Loading 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. " <br> "; $result =mysql_query ($sql); } Mssql_close ($conn); Close Database ?> |