php uses pdo to connect to the mssql server database instance, pdomssql
The example in this article describes the method of using php's pdo to connect to Microsoft's mssql server database. It is shared with everyone for your reference. The specific implementation method is as follows:
Copy code The code is as follows:
$dsn = 'mssql:dbname=bookStore_demo;host=192.168.1.106';
$user = 'sa';
$password = '123';
//mssql_connect('192.168.1.106','sa','123');
//echo 22;
try {
// echo 11;
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
//$sql = 'select * from article';
$sth = $dbh->query($sql);
$result = $sth->fetchAll();
var_dump($result);
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/932487.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/932487.htmlTechArticlephp uses pdo to connect to mssql server database instance, pdomssql This example describes the use of php's pdo to connect to Microsoft's mssql server The database method is shared with everyone for your reference. Specific actual...