I'm making a movie website and you can search through the database to find a wanted title but I have a problem... How to search a database with PDO? I have something like this:
$search=$_GET['search'];
$search='%'.$search.'%';
$db = new mysqli($DBhost, $DBuser, $DBpassword, $DBdatabase);
$sql="SELECT id, title, year, front_image, description FROM a358_filmovi WHERE title LIKE ?";
$sl=$db->prepare($sql);
$sl->bind_param('s',$search);
$sl->execute();
$sl->bind_result($id, $title, $year, $front_image, $description);
while($sl->fetch()){
?>
DATA OUTPUT
<?php
}
And the problem is that I have record Harry Potter and the Deathly Hallows: Part 1 and if I search for Harry Potter it will display that movie as a result but if I search for Harry potter, it won't display anything (blank result).
That's just an example movie, it's not working for any movie from the database.
How can I edit this code to match every result from search input, uppercase or lowercase?
Thanks in advance.