protected function convertWhereToString(array $whereArray = array(), $concatenationOperator = " AND ", $assignmentOperator = "=")
    {
        if (empty($whereArray)) {
            return false;
        }

        $returnWhereStringToken = array();

        //Check if the the keys is AND or OR, if yes then use that as the concat operator
        foreach ($whereArray as $key => $val) {
            $_key = strtoupper($key);

            if ((in_array($_key, array("OR","AND","LIKE"))) && is_array($val) && !empty($val)) {
                $_assignmentOperator = ($_key == "LIKE") ? $_key : $assignmentOperator;
                $returnWhereStringToken = array_merge($returnWhereStringToken, array($this->convertWhereToString($val, " " . trim($key) . " ", $_assignmentOperator)));
            } else {
                $returnWhereStringToken[] = "$key {$assignmentOperator} '$val'";
            }
        }

        return implode($concatenationOperator, $returnWhereStringToken);
    }
protected function convertWhereToString(array $whereArray = array(), $concatenationOperator = " AND ", $assignmentOperator = "=")
    {
        if (empty($whereArray)) {
            return false;
        }

        $returnWhereStringToken = array();

        //Check if the the keys is AND or OR, if yes then use that as the concat operator
        foreach ($whereArray as $key => $val) {
            $_key = strtoupper($key);

            if ((in_array($_key, array("OR","AND","LIKE"))) && is_array($val) && !empty($val)) {
                $_assignmentOperator = ($_key == "LIKE") ? $_key : $assignmentOperator;
                $returnWhereStringToken = array_merge($returnWhereStringToken, array($this->convertWhereToString($val, " " . trim($key) . " ", $_assignmentOperator)));
            } else {
                $returnWhereStringToken[] = "$key {$assignmentOperator} '$val'";
            }
        }

        return implode($concatenationOperator, $returnWhereStringToken);
    }
protected function convertWhereToString ( array $ whereArray = array ( ) , $ concatenationOperator = " AND " , $ assignmentOperator = "=" ) { if ( empty ( $ whereArray ) ) { return false ; } $ returnWhereStringToken = array ( ) ; //Check if the the keys is AND or OR, if yes then use that as the concat operator foreach ( $ whereArray as $ key => $ val ) { $ _key = strtoupper ( $ key ) ; if ( ( in_array ( $ _key , array ( "OR" , "AND" , "LIKE" ) ) ) && is_array ( $ val ) && ! empty ( $ val ) ) { $ _assignmentOperator = ( $ _key == "LIKE" ) ? $ _key : $ assignmentOperator ; $ returnWhereStringToken = array_merge ( $ returnWhereStringToken , array ( $ this -> convertWhereToString ( $ val , " " . trim ( $ key ) . " " , $ _assignmentOperator ) ) ) ; } else { $ returnWhereStringToken [ ] = "$key {$assignmentOperator} '$val'" ; } } return implode ( $ concatenationOperator , $ returnWhereStringToken ) ; }
This function converts an array into a Where String.

@param array $whereArray
@param string $concatenationOperator

@return bool|string
This function converts an array into a Where String .