0

I wan't to create sql query search based on sidebar options selected for holiday search. So i generate an array of clicked values, and based on that array keys i generate dynamic_str;

$base_sql = 'SELECT * FROM holidays';
$dynamic_str_sample ='WHERE country IN (:countries)';
//country - one of the keys, :countries values([france, uk, etc]) Adding some 'AND' and other key value pairs based on options selected. 

> $stmt = $this->db->bindValue(:countries, $string-with-commas-originally-made-from-array-values);
// there is a for loop if i need to bind multiple values (:values[index]);

doesn't work. Might be a bit confusing, adding sample selection array under which i'm constructing sql query:

Array
(
    [Price] => Array (
            [0] => 101-300
            [1] => 301-500
            [2] => 501-700
        )

    [KelionesTipas] => Array
        (
            [0] => chill
        )

    [Country] => Array
        (
            [0] => Spain
            [1] => Portugal
        )
)
mario31
  • 23
  • 4

0 Answers0