0
  1. 如何在 medoo 中编写这个 sql 查询?

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

我试了一下,

select('users','*',["AND"=>["name[=]"=>"John","age[=]"=>35]]);
  1. 上述查询在找到数据时返回一个数组,并在不存在此类记录时返回一个布尔值而不是空数组。

有人可以解释一下原因吗?

4

1 回答 1

2

原因很简单:当您想在继续之前检查查询是否返回数据时,它更容易使用。例如:

if ($myquery) {
    return $myquery;
} else {
    return "no data was returned from 'myquery'";
}
于 2016-02-20T16:29:12.130 回答