Using wildcards in prepared statement

You have to pass parameters to bind_param() by reference, which means you have to pass a single variable (not a concatenated string). There’s no reason you can’t construct such a variable specifically to pass in, though:

$className="%" . $this->className . '%';
$query->bind_param('s', $className);

Leave a Comment