While displaying the filtered data, this sql can filter data as per $locationone and $locationtwo.
But it is failing to filter data as per $cate
I mean its displaying all the rows from both locations and failing to filter it as per science(topic)
$cat= "science";
$cate= preg_replace("#[^0-9a-z]#i","", $cat);
$locationone= "dhk";
$locationtwo= "ctg";
preg_replace("#[^0-9a-z]#i","", $locationone);
preg_replace("#[^0-9a-z]#i","", $locationtwo);
$sql= "SELECT * FROM post INNER JOIN user ON post.user_id= user.id
WHERE post.topic LIKE '%$cate%'
AND post.location LIKE '%$locationone%'
OR post.location LIKE '%$locationtwo%'
order by post_id desc";