$user = $_COOKIE['c_username'];
$filter = filter_var($_POST['buscar_inventario'], FILTER_SANITIZE_STRING);
$query = "SELECT
Inv_Id,
Inv_Ref,
Inv_Name,
Inv_Desc,
Inv_Purch_Price,
Inv_Sale_Price,
Inv_Quant,
Inv_Date,
Inv_Public
FROM inventory
WHERE
Inv_User = :user
AND Inv_Name LIKE %:filter%
OR Inv_Desc LIKE %:filter%
OR Inv_Ref LIKE %:filter%
OR Inv_Purch_Price LIKE %:filter%
OR Inv_Sale_Price LIKE %:filter%
ORDER BY Inv_Ref ASC
LIMIT 20";
$result = $base -> prepare($query);
$result -> bindValue(':user', $user);
$result -> bindValue(':filter', $filter);
$result -> execute();
The error that generates me is the following:
SQLSTATE [42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%' product '% OR Inv_Desc LIKE%' product '% OR Inv_Ref LIKE%' product '% OR Inv_P' at line 1
Is it possible that I get the error by using %:filter%
?