Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
pdo php查询未显示任何用于调试的内容_Php_Sql Server_Pdo - Fatal编程技术网

pdo php查询未显示任何用于调试的内容

pdo php查询未显示任何用于调试的内容,php,sql-server,pdo,Php,Sql Server,Pdo,我有上面的问题,我只得到 print_r($con->_con); echo "(SELECT * FROM fvwItems WHERE itemname LIKE :key)"; echo "\PDO::errorInfo():\n"; print_r($con->_con->errorInfo());// no error showing $stmt = $con->_con->prepare("(SELECT * FROM fvwItems WHERE it

我有上面的问题,我只得到

print_r($con->_con);
echo "(SELECT * FROM fvwItems WHERE itemname LIKE :key)";
echo "\PDO::errorInfo():\n";
print_r($con->_con->errorInfo());// no error showing
$stmt = $con->_con->prepare("(SELECT * FROM fvwItems WHERE itemname LIKE :key)", array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
echo $stmt;//not putting any output
echo "\PDO::errorInfo():\n";
print_r($con->_con->errorInfo());
在chrome的开发工具中。我在try/catch中也有查询,但我不知道查询中有什么错误或问题,因为它没有给我足够的信息来告诉我哪个有问题

任何超出$stmt=$con->\u con->prepareSELECT*的项,如:key,arrayPDO::ATTR\u CURSOR=>PDO::CURSOR\u滚动;未显示错误或否

检查查询有什么问题的最佳方法是什么

更新

我的连接是这样的:

Resource id #10
(SELECT * FROM fvwItems WHERE itemname LIKE :key)\PDO::errorInfo():
我在想我需要一个新的PDO,这样它才能运行

导致

$this->_connection = new PDO("sqlsrv:Server=$serverName;Database=".DB_NAME.";",DB_USER,DB_PASS);
print_r($this->_connection);

但这不是连接,在创建PDO对象设置此选项后出现错误

PDO Object
(
)
你没有告诉我们$con->\u-con是什么,它实际上有一个prepare方法吗?您是否已将PHP配置为?
PDO Object
(
)
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);