"fff","ConnectionPooling"=>'','UID '=>'sa','PWD ..."/> "fff","ConnectionPooling"=>'','UID '=>'sa','PWD ...">

首頁  >  文章  >  後端開發  >  php連線sql server資料庫

php連線sql server資料庫

巴扎黑
巴扎黑原創
2016-11-22 10:51:222214瀏覽

安裝好php的sqlsrv模塊 
//本地連接 
$serverName = "CX95DLISVW4C6TKaaa";//計算機名實例名 
$connectionInfo = array("Database"=>"fff","ConnectionPooling"=>'',' UID'=>'sa','PWD'=>'123'); 
$conn = sqlsrv_connect( $serverName, $connectionInfo); 
if( $conn == false) 

 
    die( print_r( sqlsrv_errors(), true)); 
}else{ 
echo "dfdf"; 
$query=sqlsrv_query($conn,"selectlecto from dlif"; $query)){ 
print_r($row); 
     } 
//print_r($query); 


//遠端連線 
$serverName = "192.1688com =>"CIA","ConnectionPooling"=>'','UID'=>'sa','PWD'=>'360kad.com'); 
$conn = sqlsrv_connect( $serverName, $connectionInfo); 
if ( $conn == false) 

    echo "連結失敗!"; 
    die( print_r( sqlsrv_errors(), true)); 
}else{ select * from CodeSiteTaker_Model"); 
while($row = sqlsrv_fetch_array($query)){ 
print_r($row); 
    

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn