I am trying to write a prepared statement for a very basic search function. Basically, I just need to to return the "title" when the title contains the search term (but may also contain more words than the search term).
I can do this in normal mysqli but not with a prepared statement (which I need for security, right?)
This works but no prepared statement:
$sql = "SELECT title, description FROM quiztime WHERE title LIKE '%".$query."%' OR description LIKE '%".$query."%'";
This doesn't work:
$stmt = $conn->prepare("SELECT user, title FROM quiztime WHERE title LIKE %?%");
I get in log: PHP Fatal error: Uncaught Error:
So how can I make that into a prepared statement? Many thanks!