I'm executing a simple query, without bound parameters, using PDO. I have tested it directly against my database and it executes cleanly, returning the expected results. However, when I plug it in to my PDO object and call fetchAll(), it returns an empty array.
$query = 'SELECT count(*) as mycount FROM mytable';
$mysql = $connection->prepare($query);
$result = $mysql->fetchAll();
print_r($result);
Expected result:
array
(
[mycount] => 8
)
Actual result:
array
(
)
Any ideas what might be causing this, or how to go about troubleshooting this?