Im working on a geolocation app and want to return a radius result according to tags the user
$tags = preg_replace('/\s+/', '', $tags);
$tags_list = [];
$tags_list = explode(',', $tags);
$tags = implode(" OR c.title=", $tags_list);
echo $tags;
if(
!empty($latitude) &&
!empty($longtitude) &&
!empty($radius)
){
    $qry = "SELECT o.id, o.title, o.icon, o.description,
    (
        6371 * acos
        (
            cos(
                radians( :lat )
            )
            * cos(
                radians( lat)
            ) * cos(
                radians( lng) - radians( :lng )
            ) + sin(
                radians( :lat )
            ) * sin(
                radians( lat)
            )
            )
            ) AS distance
            FROM objects o, category_object co, category c
            WHERE o.id = co.id_object AND co.id_category = c.id AND c.title=:title
            HAVING distance/1000 <= :radius
            ORDER BY distance/1000 ASC;";
    $stmt = $db->prepare($qry);
    $stmt->bindParam(":lat", $latitude);
    $stmt->bindParam(":lng", $longtitude);
    //Here
    $stmt->bindParam(":title", $tags);
    $stmt->bindParam(":radius", $radius);
    if($stmt->execute()){
        while ($result = $stmt->fetch(PDO::FETCH_OBJ)) {
            echo json_encode(array("type" => "FeatureCollection",
                "features" => array(
                    "type" => "Feature",
                    "geometry" => array("type" => "Point",
                        "coordinates" => [$latitude, $longtitude]),
                    "properties" => array(
                        "ID" => $result->id,
                        "icon" => $result->icon,
                        "tags" => "",
                        "title" => $result->title,
                        "description" => $result->description))), JSON_UNESCAPED_SLASHES);
            echo "\n\n";
        }
    }
If I input "mexican" it works perfectly fine.
localhost/../radius.php&lat=..&lng=..&radius=..&tags=mexican  <<<-- works
The problem is once I input
localhost/../radius.php&lat=..&lng=..&radius=..&tags=mexican,restaurants  <<<-- doesn't work
I think the problem is that I convert the code into a preparted statement, thats why I would like to know how to change the way I input it.
Thank you for your time!
DB connection code
<?php
class Database {
public function getConnection() {
  $this->conn = null;
  try {
    $this->conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name, $this->username, $this->password);
    $this->conn->exec("set names utf8");
  } catch (PDOException $e) {
    echo "connection error" . $e->getMessage();
  }
  return $this->conn;
  }
  }
  ?>
 
    