r ::在redbean中查找是否支持多个搜索字段

问题描述:

我正在尝试通过多个条件进行搜索。我已经在Redbean的网站上搜索了正确的语法,但他们提供的仅仅是仅使用一个搜索条件的示例。r ::在redbean中查找是否支持多个搜索字段

$match = R::find('tuba', ' displayType = ? ', [ '$displayType' ]); 

我想通过inventoryNUM进行搜索。我试图执行此代码,但无济于事。

$match = R::find('tuba', ' displayType = ? , inventoryNUM = ? ', [ '$displayType' , '$inventoryNUM' ]); 

这是正确的语法吗? R ::查找是否支持多个搜索条件?

你可以做到这一点有以下几点: $match = R::find('tuba', ' displayType = ? AND inventoryNUM = ? ', [$displayType, $inventory]);

只记得第二个参数,一切都是SQL query to find the desired bean, starting right after WHERE clause。您也可以使用问号表示法或插槽记号(:keyname)。

以下查询相当于上面的查询: $match = R::find('tuba', ' displayType = :displayType AND inventoryNUM = :inventoryNUM ', [':displayType' => $displayType, '':inventoryNUM' => $inventory]);