时间:2021-07-01 10:21:17 帮助过:15人阅读
class DB_sqlsrv
{
var $query;
var $result;
function DB_sqlsrv($text)
{
$serverName = "192.168.0.1";
$connectionInfo = array(
"UID"=>"sa",
"PWD"=>"sa",
"Database"=>"ttt"
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$this->query=sqlsrv_query($conn, $text);
}
//以对象形式取得查询结果数据
function Record()
{
$this->result=sqlsrv_fetch_object($this->query);
return ($this->result)?($this->result):false;
}
}
$sql=new DB_sqlsrv("select * from username");
$record=$sql->Record();