【发布时间】:2017-01-23 05:31:03
【问题描述】:
我需要在 redbean php 中使用 where 条件进行计数查询
我用过
R::count("company","country like 'United States'");
where country name 是 where 条件
请提出一些建议
【问题讨论】:
标签: redbean
我需要在 redbean php 中使用 where 条件进行计数查询
我用过
R::count("company","country like 'United States'");
where country name 是 where 条件
请提出一些建议
【问题讨论】:
标签: redbean
Redbean 在第三个参数上需要一个数组,所以你应该使用:
R::count("company", "country like ?", ["United States"]);
请注意,每个? 都应该匹配数组中的一个元素,但是如果您有多个相同值的条件,您也可以使用一次:param,例如:
R::count("company", "country like :name OR city like :name", [":name" => "United States"]);
【讨论】:
R::count("company","country like 'United States'");
这很好用…………
但这不是
R::count("company","country like '".$country."'");
【讨论】: