php有专门的sql server操作函数,举个简单的例子,是查询的
$serverName = "localhost"; //数据库服务器地址
$uid = "root"; //数据库用户名
$pwd = "123456"; //数据库密码
$connectionInfo = array("UID"=>$uid, "PWD"=>$pwd, "Database"=>'databasename');
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn == false){
echo "连接数据库正宏失败!";
die( print_r( sqlsrv_errors(), true));
}
$sql = "select 举橡册* from user";
$query = sqlsrv_query( $conn, $sql , array(), array( "Scrollable" => SQLSRV_CURSOR_KEYSET ));
$num_rows = sqlsrv_num_rows($query);
if($num_rows > 如仔0){
while ($row = sqlsrv_fetch_array($query)){
echo $row['aaaa'];
}
}
其它的操作也同理,举一反三