fix wrong number of rows generated by PDO 'SELECT' query