Here is what I’ve got at the moment. It is not working. How do I go about this?
if (isset ($_GET['category'])) {
$category = $_GET['category'];
$keyword = $_GET['keyword'];
if (
($category == 'news') ||
($category == 'blog') ||
($category == 'articles')
)
{
try {
$sql = 'Select * from blog where ((title LIKE :keyword) OR (body LIKE :keyword))
AND type LIKE :category';
$results = $pdo->prepare($sql);
$results->bindValue(':keyword', '%' . $keyword . '%');
$results->bindValue(':category', '%' . $category . '%');
$results->execute();
$items = $results -> fetchAll (PDO::FETCH_OBJ);
}
catch (PDOException $e) {
echo 'Error'. $e->getMessage();
}
}
if ($category == 'videos'){
header("Location: /search-videos.php?keyword='$keyword'");
}
}