I have the following query:
SELECT p.*
FROM property p
INNER JOIN property_meta pm ON p.id = pm.property_id
WHERE LOWER(p.name) LIKE concat("%", :title, "%") AND p.deleted = :deleted AND ((pm.meta_key = :area_key AND pm.meta_value IN (:area_value)) ) GROUP BY p.id
which is executed using the following binding parameters:
$bind[':title'] = '';
$bind[':deleted'] = 0;
$bind[':area_key'] = 'property_area';
$bind[':area_value'] = '1217, 1270';
$sth = $this->db->prepare($query);
$sth->execute($bind);
return $sth->fetchAll();
the problem is that I doesn't get any result, but the most weird thing is that if I execute the query using PhpMyAdmin
console, I correctly get the results.
is there any mistake I did?
Table structure
the property
table have the following structure:
| id | title | deleted
1 test 0
2 test2 0
and property_meta
have this structure:
| id | property_id | meta_key | meta_value
1 1 property_area 1217
4 2 property_area 1270