Heim  >  Artikel  >  Backend-Entwicklung  >  php使用pdo连接mssql server数据库实例,pdomssql_PHP教程

php使用pdo连接mssql server数据库实例,pdomssql_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:10:471034Durchsuche

php使用pdo连接mssql server数据库实例,pdomssql

本文实例讲述了利用php的pdo来连接微软的mssql server数据库的方法,分享给大家供大家参考。具体实现方法如下:

复制代码 代码如下:
$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);

希望本文所述对大家的PHP程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/932487.htmlTechArticlephp使用pdo连接mssql server数据库实例,pdomssql 本文实例讲述了利用php的pdo来连接微软的mssql server数据库的方法,分享给大家供大家参考。具体实...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn