Ok, look at this code:
// Query building!
$query_params = array();
$query = ' ';
if (!empty($data['estado'])) {
$query .= 'estado = ? AND ';
$query_params[] = $data['estado'];
}
if (!empty($data['ref'])) {
$query .= 'ref LIKE "%?%" AND ';
$query_params[] = $data['ref'];
}
On the first if block, we append to the query 'estado = ?', and redbeans runs it just fine. However, when I do LIKE "%?%", redbean can't simply recognize the token, and this is the error I get:
Message: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens File: /home/imovelli/public_html/Components/Redbean/rb.php Line: 267
I've searched but couldn't find, is there any specific way of querying for a substring in redbeans?