From: Thomas Mudrunka Date: Thu, 18 Aug 2011 22:24:01 +0000 (+0200) Subject: Fixnuty vyhledavani - konflikt v nazvech promennych a chybejici zavorky v query... X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=5895162b21c18b47ffff966184e8f2917095e6dd;p=mirrors%2FSokoMan.git Fixnuty vyhledavani - konflikt v nazvech promennych a chybejici zavorky v query... --- diff --git a/index.php b/index.php index ce099b1..9900ba7 100755 --- a/index.php +++ b/index.php @@ -342,13 +342,13 @@ class Sklad_DB extends PDO { if($search) { $search = $this->quote($search); if(!isset($search_fields[$class])) $this->post_redirect_get($class, "Ve tride $class zatim vyhledavat nemozno :-("); - $search = ''; - foreach($search_fields[$class] as $column) $search .= "OR $column REGEXP $search "; - $where[] = "FALSE $search"; + $sql_search = ''; + foreach($search_fields[$class] as $column) $sql_search .= "OR $column REGEXP $search "; + $where[] = "FALSE $sql_search"; } elseif($id) $where[] = "$class$suffix_id = $id"; if(!$history && $this->contains_history($class)) $where[] = $class.'_valid_till=0'; - if($where) $sql .= 'WHERE '.implode(' AND ', $where)."\n"; + if($where) $sql .= 'WHERE ('.implode(') AND (', $where).")\n"; //ORDER if(!$order) $order = $class.$suffix_id; if($this->contains_history($class)) $order .= ",${class}_valid_from DESC";