Hello,
I created a method to show the products by category but the condition I placed is not working if condition is working properly but else if condition not working properly
if(isset($_GET["catid"])) {
$statement = "posts WHERE cat_name='$cat' ORDER BY pid ASC";
$results = mysqli_query($connection,"SELECT * FROM {$statement} LIMIT {$startpoint} , {$per_page}");
} elseif(isset($_GET["cat"])) {
$catname = $_GET["cat"];
$statement = "posts WHERE parent='$catname' ORDER BY pid ASC";
$results = mysqli_query($connection,"SELECT * FROM {$statement} LIMIT {$startpoint} , {$per_page}");
} else {
$statement = "posts ORDER BY pid ASC";
$results = mysqli_query($connection,"SELECT * FROM {$statement} LIMIT {$startpoint} , {$per_page}");
}