Reputation: 383
I am using this:
$stmt = $this->getEntityManager()->getConnection()->prepare('SELECT * from tbl_users');
$stmt->execute();
How to get the results back in variables:
$stmt->getResults()
is not working
Upvotes: 1
Views: 513
Reputation: 17976
You forgot about fetching result. fetchAll()
could help you:
$stmt = $this->getEntityManager()
->getConnection()
->prepare('SELECT * from tbl_users');
$stmt->execute();
$result = $stmt->fetchAll();
If you want to hydrate your TblUsers
after fetching data - you can try to to next:
$tblUser = new TblUsers();
$tblUser->fromArray($result);
Upvotes: 2