Maison >développement back-end >tutoriel php >版主 sqlsrv 自个儿弄的简单类还需要您的帮助
版主 sqlsrv 自己弄的简单类还需要您的帮助
<br />class DB_sqlsrv<br />{<br /> var $query;<br /> var $result;<br /> function DB_sqlsrv($text)<br /> {<br /> <br /> $serverName = "192.168.0.1";<br /> $connectionInfo = array(<br /> "UID"=>"sa",<br /> "PWD"=>"sa",<br /> "Database"=>"ttt"<br /> $conn = sqlsrv_connect( $serverName, $connectionInfo);<br /> $this->query=sqlsrv_query($conn, $text);<br /> }<br /> //以对象形式取得查询结果数据<br /> function Record()<br /> {<br /> $this->result=sqlsrv_fetch_object($this->query);<br /> return ($this->result)?($this->result):false;<br /> }<br />}<br />$sql=new DB_sqlsrv("select * from username");<br />$record=$sql->Record();<br />