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

Executing queries

I have the following piece of code: https://pastebin.com/1CYsGKqM

Don't be scared to open, it is very short :)

But this part of code is not doing well. If i enter Azebaijan, New york , it returns true... What am i doing wrong?



98.9k

You have to return just one record from the query to expect a ´false´when it isn't returning a single record.



17.0k
Accepted
answer

Solved it this way :

  1. $countrycitytest = LocationTest::findFirst(array(
  2. "conditions" => "cc_fips = '$enteredcountry' AND full_name_nd = '$enteredlocation'"
  3. ));