in PHP using MYSQLI you need to define a new parameter which will be declared as:
$stmt = mysqli_prepare($con,"SELECT * FROM table WHERE name LIKE ?");
$newParameter='%'.$query.'%';
mysqli_stmt_bind_param($stmt, "s", $newParameter);
mysqli_stmt_execute($stmt);
I will just adapt Chad Birch's answer for people like me who are used to utilize
bindValue(...)
for PDO:You can use the concatenation operator of your respective sql database:
I'm not familar with other databases, but they probably have an equivalent function/operator.
in PHP using MYSQLI you need to define a new parameter which will be declared as:
this works for me..
You could try something like this:
For me working great, I've looked for answer hours, thx.
The % signs need to go in the variable that you assign to the parameter, instead of in the query.
I don't know if you're using mysqli or PDO, but with PDO it would be something like:
EDIT :: For
mysqli
user the following.