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