system/classes/Db_MySQL.php
protected function conditionStringFromArray($dataMember, $opening, $sep)
    {
        if (empty($this->$dataMember)) {
            return 0;
        }
        $this->query .= $opening;
        $count = count($this->$dataMember);
        for($i=0; $i<$count; $i++) {
            $statement = $this->{$dataMember}[$i];
            $this->query .= '(';
            $sCount = count($statement[0]);
            for($j=0; $j<$sCount; $j++) {
                
                // See if a custom separator (conjuction) was set, and grab it.
                $customSep = $this->getArrayConditionSep($dataMember, $i, $j);
                
                $this->query .= $this->getArrayCondition($dataMember, $i, $j);
                if ($sCount-1 != $j) {
                    if ($customSep) {
                        $this->query .= $customSep;
                    }
                    else {
                        $this->query .= $sep;
                    }
                }
            }
            $this->query .= ')';
            if ($count-1 != $i) {
//                echo $dataMember;
//                var_dump($this->$dataMember);
//                var_dump($this->{$dataMember}[$i+1]);
//                echo $i;
                $this->query .= ' '.$this->{$dataMember}[$i+1][1].' ';
            }
        }
    }
protected function conditionStringFromArray($dataMember, $opening, $sep)
    {
        if (empty($this->$dataMember)) {
            return 0;
        }
        $this->query .= $opening;
        $count = count($this->$dataMember);
        for($i=0; $i<$count; $i++) {
            $statement = $this->{$dataMember}[$i];
            $this->query .= '(';
            $sCount = count($statement[0]);
            for($j=0; $j<$sCount; $j++) {
                
                // See if a custom separator (conjuction) was set, and grab it.
                $customSep = $this->getArrayConditionSep($dataMember, $i, $j);
                
                $this->query .= $this->getArrayCondition($dataMember, $i, $j);
                if ($sCount-1 != $j) {
                    if ($customSep) {
                        $this->query .= $customSep;
                    }
                    else {
                        $this->query .= $sep;
                    }
                }
            }
            $this->query .= ')';
            if ($count-1 != $i) {
//                echo $dataMember;
//                var_dump($this->$dataMember);
//                var_dump($this->{$dataMember}[$i+1]);
//                echo $i;
                $this->query .= ' '.$this->{$dataMember}[$i+1][1].' ';
            }
        }
    }
Create a string from a multi-demensional Database class array.
It calls getArrayCondition() for each item and expects the returned result to be a string.
THIS CLASS IS SPECIFICALLY FOR CONDITIONS (Where, Having).
It assumes the following structure:
[
[
[
[column, operator, value],
[name, LIKE, %s],
[price, >, 100]
],
AND
],
[
[column, operator, value, conjunction],
[name, LIKE, %s, OR],
[price, >, 100]
],
AND
]
]