0
  1. How to write this sql query in medoo?

    select * from users where name='John' and age=35?
    

I tried it like,

select('users','*',["AND"=>["name[=]"=>"John","age[=]"=>35]]);
  1. The above query returns an array when data is found and returns a boolean value instead of an empty array when no such record exists.

Can someone please explain the reason for this?

Alex Andrei
  • 7,315
  • 3
  • 28
  • 42
Sean
  • 21
  • 3

1 Answers1

2

The reason is simple: It's more easy to use when you want to check if the query returns data before continuing. For example:

if ($myquery) {
    return $myquery;
} else {
    return "no data was returned from 'myquery'";
}
SapuSeven
  • 1,473
  • 17
  • 30
Soldeplata Saketos
  • 3,212
  • 1
  • 25
  • 38