V
V
Valery Miladze2020-10-10 05:22:45
DLE
Valery Miladze, 2020-10-10 05:22:45

How to select multiple values ​​of one additional field in ajax handler?

foreach( $xfarr as $ono => &$value ) {
  if( substr_count($value, '|') ) $value = explode('|', $value);
  $ono = $db->safesql($ono);
  if( is_array($value) ) {
    if( $ono == $find_sort ) {
      $order_by[] = Poiskxf($ono, $value, $db, $xfarr);
    } else {
      if( $ono != $direction_sort ) {
        foreach( $value as $index => &$val ) {
          $url_poisk[$ono][] = $val;
          $val = $db->safesql($val);
          $poiskarr[$ono][] = "SUBSTRING_INDEX(SUBSTRING_INDEX(xfields, '{$ono}|', -1), '||', 1) LIKE '%{$val}%'";
        }
        $where[] = '(' . implode(' AND ', $poiskarr[$ono]) . ')';
      }
    }
  }
}

There is an additional field in which, when publishing, you can select several of its values ​​using the select list
. Above is the code, ajax search, which is not designed for sorting news by several values. Ato when I select one value in the sort, it displays the news, but as soon as I add the second value to the select multiple, it does not display anything at all. Because it just duplicates the new value, this is what the console shows:
kniga=%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0&kniga=%D0%9F%D0%B8%D1%82%D0%B5%D1%80%D0%B1%D1%83%D1%80%D0%


How to properly edit and insert explode so that it adds values ​​through "; " and does not duplicate?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question