Question: Hello, Basically, when I try to use the search feature, it does nothing. What I expect is to display the matched certs from the tblevents
Hello,
Basically, when I try to use the search feature, it does nothing. What I expect is to display the matched certs from the tblevents based on EventName & EventDescription. Any advice?
session_start();
error_reporting(0);
include('includes/config.php');
// Search Functionality
if (isset($_GET["search"])) {
$search = $_GET["search"];
$sql = "SELECT EventName,EventDescription, EventLocation,EventStartDate,EventEndDate,EventImage,id FROM tblevents WHERE IsActive = 1 AND (EventName LIKE '%$search%' OR EventLocation LIKE '%$search%') ORDER BY id DESC";
$query = $dbh->prepare($sql);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
$cnt = 1;
} else {
// Fetching all Certificates
$isactive = 1;
$sql = "SELECT EventName,EventDescription, EventLocation,EventStartDate,EventEndDate,EventImage,id from tblevents where IsActive=:isactive order by id desc";
$query = $dbh->prepare($sql);
$query->bindParam(':isactive', $isactive, PDO::PARAM_STR);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
$cnt = 1;
}
?>
//CSS Files
- Home
- All Certificates
Recently Added Certificates
// Fetching Certs
$isactive=1;
$sql = "SELECT EventName,EventDescription,EventLocation,EventStartDate,EventEndDate,EventImage,id from tblevents where IsActive=:isactive order by id desc ";
$query = $dbh -> prepare($sql);
$query->bindParam(':isactive',$isactive,PDO::PARAM_STR);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query->rowCount() > 0)
{
foreach($results as $row)
{
?>
EventStartDate);?>To
EventEndDate);?>
EventName);?>
EventDescription);?>
Location : EventLocation);?>
id);?>" class="btn-def bnt-2 small">View Details
No Record Found
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
