I'm creating a simple search query for a tutorial which I'm working through, but it fails. I'm getting the following error:
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in C:\xampp\htdocs\cms\blog.php on line 73
I'm new to php and don't understand what this means. Can anyone help a noob?
if(isset($_GET["search"])){
$search = $_GET["search"];
$sql = "SELECT * FROM posts WHERE
datetime LIKE :Search
OR title LIKE :Search
OR category LIKE :Search
OR author LIKE :Search
OR post LIKE :search";
$stmt = $connect->prepare($sql);
$stmt->bindValue(':search','%'.$search.'%');
$stmt->execute();
}