Hi all I have a site develop in cakephp and I have a query in pdo where I want to insert a limit value. I have try in this mode:
$max_result = 10;
$search = "test";
$product_alias = $this->ProductAlias->query(
'SELECT DISTINCT *
FROM product_aliases
WHERE product_aliases.alias
LIKE :search LIMIT :limit_search'
,array('search' => '%'.$search.'%','limit_search' => intval(trim($max_result)))
);
I have tried also:
...
WHERE product_aliases.alias
LIKE :search
LIMIT :limit_search'
,array('search' => '%'.$search.'%','limit_search' => intval($max_result)));
and
...
WHERE product_aliases.alias
LIKE :search
LIMIT :limit_search'
,array('search' => '%'.$search.'%','limit_search' => $max_result));
but always return me this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10' at line 1
I have seen that there is the bind but I don't know how to apply to this situation. Any solutions?