We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

find and findFirst, with and w/out parameters, always returning empty

Hi there. I have a pretty shitty error and I can't get a query working.

I have this simple lines:

$trivia = KptTrivias::findFirst('id_kpt_events="10"');
if ($trivia) {
    $this->view->trivia = $trivia;
} else {
    $this->view->trivia = 'NO_DATA_FOUND';
}

and then in the volt file I have:

<?php echo json_encode($trivia, JSON_PRETTY_PRINT); ?>

And well, nothing comes out. My database has just one registry:

How is that even possible?



6.4k
Accepted
answer
edited Jul '14

BTW, I already realized what was going on, it was a matter of collation. I made manual insertions in database, and the collation was UTF-8. removing the special character was all good.