I am trying to get a count of items with PDO (on a MySql table). I read somewhere that the rowCount does not work on MySql. Is this correct?
So far I definitely can't get it to work as I keep getting count=0.
Could anyone give me an idea so I can avoid going back to the db every time? I have multiple queries that look similar to this one:
$items = $con -> prepare("SELECT * FROM item_descr ORDER BY $sortBy DESC");
$count = $items -> rowCount();
$items -> execute();
while($info = $items->fetch(PDO::FETCH_ASSOC)) { ... }
I want to try to avoid an extra query with SELECT COUNT (*)
Thanks!