I am not going into the details of why I suggest you should reconsider your query logic, but for the task at hand try this:
$where=array();
foreach($array as $id){
$where[]="cat=$id[0] AND sub = $id[1] AND fir = $id[2]";
}
$sql='SELECT * FROM table WHERE ('.implode(') OR (',$where).')';
$query=mysqli_query($con,$sql);
while ($thiss = mysqli_fetch_array($query))
echo $thiss['name'];