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());
I have the query above and I only get
Resource id #10
(SELECT * FROM fvwItems WHERE itemname LIKE :key)\PDO::errorInfo():
In the dev tools of chrome. I also have the query inside try/catch
but I dont what error or what is the problem in my query because it is not giving me enough information to tell which is having problem.
Anything beyond the $stmt = $con->_con->prepare("(SELECT * FROM fvwItems WHERE itemname LIKE :key)", array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
is not shown either error or not
What could be the best way to check what is wrong with the query?
UPDATE
My connection is like this:
$connectionOptions = array(
"Database" => DB_NAME,
"Uid" => DB_USER,
"PWD" => DB_PASS
);
//Establishes the connection
$this->_connection = sqlsrv_connect($serverName, $connectionOptions);
I was thinking I need it to be new PDO
so that it will run?
Like
$this->_connection = new PDO("sqlsrv:Server=$serverName;Database=".DB_NAME.";",DB_USER,DB_PASS);
print_r($this->_connection);
Resulting in
PDO Object
(
)
But this is not connecting and it is getting error