Home >Backend Development >PHP Tutorial >sqlsrv 自己弄的简单类为什么有有关问题

sqlsrv 自己弄的简单类为什么有有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:13:121051browse

sqlsrv 自己弄的简单类为什么有问题,求助


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();

?>

我看来看去这个类是没有问题的,为什么执行一直是这个样子
PHP Parse error:  syntax error, unexpected T_VARIABLE in E:\web\test\test\test.php on line 21
不知道哪里的问题,如果把Record()写在sqlsrv()里面可以执行的。谢谢
------解决思路----------------------
哪行报错也不标示一下吗,有高亮代码功能为什么不用。
------解决思路----------------------
21 行在哪里?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn