Loading

Thinkphp3.1 php 链接SqlServer

ThinkPHP链接

M("lk_employeeInfo","Null/表前缀","sqlsrv://账号:密码@服务器:端口/数据库")->query("select * from lk_employeeinfo where state = 'onJob'");

 PHP链接

try{  
    $db = sqlsrv_connect('服务器',array("UID"=>'账号', "PWD"=>'密码', "Database"=>"数据库"));
}catch(PDOException $e){  
    echo "ERROR:".$e->getMessage();  
}
$a = sqlsrv_query($db,"select * from lk_employeeinfo where state = 'onJob'");
while( $row = sqlsrv_fetch_array( $a, SQLSRV_FETCH_ASSOC) ) {
      echo $rew['roleid'];
}

 

posted @ 2018-04-12 16:30  王召波  阅读(206)  评论(0编辑  收藏  举报