I am trying to search by more than one criteria. I have searched Redbean's site for the correct syntax but all they offer is examples using only one search criteria.
$match = R::find('tuba', ' displayType = ? ', [ '$displayType' ]);
I am trying to also search by inventoryNUM. Ive tried executing this code but to no avail.
$match = R::find('tuba', ' displayType = ? , inventoryNUM = ? ', [ '$displayType' , '$inventoryNUM' ]);
Is this the correct syntax? Does R::find even support more than one search criteria?
You can achieve this with the following: $match = R::find( 'tuba', ' displayType = ? AND inventoryNUM = ? ', [$displayType, $inventory]);
Just remember that everything in the 2nd parameter is SQL query to find the desired bean, starting right after WHERE clause
. Also you can either use the question mark notation or the slot-notation (:keyname).
The following query is equivalent to the one above: $match = R::find( 'tuba', ' displayType = :displayType AND inventoryNUM = :inventoryNUM ', [':displayType' => $displayType, '':inventoryNUM' => $inventory]);