RedBean php count 查询where
RedBean php count query with where
我需要在 redbean php 中使用条件
进行计数查询
我用过
R::count("company","country like 'United States'");
where country name is where 条件
请提出一些建议
R::count("company","country like 'United States'");
这个很好用.........
但这不会
R::count("company","country like '".$国家."'");
Redbean 在第三个参数上需要一个数组,所以你应该使用:
R::count("company", "country like ?", ["United States"]);
请注意,每个 ?
都应匹配数组中的一个元素,但如果您对同一值有更多条件,也可以使用 :param
一次代替,例如:
R::count("company", "country like :name OR city like :name", [":name" => "United States"]);
我需要在 redbean php 中使用条件
进行计数查询我用过
R::count("company","country like 'United States'");
where country name is where 条件
请提出一些建议
R::count("company","country like 'United States'");
这个很好用.........
但这不会
R::count("company","country like '".$国家."'");
Redbean 在第三个参数上需要一个数组,所以你应该使用:
R::count("company", "country like ?", ["United States"]);
请注意,每个 ?
都应匹配数组中的一个元素,但如果您对同一值有更多条件,也可以使用 :param
一次代替,例如:
R::count("company", "country like :name OR city like :name", [":name" => "United States"]);