When I'am passing $id variable in bindValue('id', $id)
it shows empty array but when I pass number in bindValue('id', 2)
,I'm getting the result in array.
$em = $this->getDoctrine()->getManager();
$connection = $em->getConnection();
$statement = $connection->prepare("SELECT s.subtitle FROM submenu as s where s.menu_id= :id");
$statement->bindValue('id', $id);
$statement->execute();
$results = $statement->fetchAll();
dump($results);
Please could anybody tell me whats my mistake in above code. I am getting empty result if I pass variable in bindvalue
function but if I use this bindValue('id',2)
I'm getting result.