public function orderBy($fields)
    {
        if (!is_array($fields)) {
            $fields = explode(",", $fields);
        }

        $orderBy = "";

        foreach ($fields as $field) {
            if (!$field = trim($field)) {
                continue;
            }
            if (!$orderBy) {
                $orderBy = "ORDER BY ";
            } else {
                $orderBy .= ", ";
            }

            if (strpos($field, " ")) {
                $orderBy .= $field;
            } else {
                $orderBy .= $this->quoteField($field);
            }
        }

        return $orderBy;
    }
public function orderBy($fields)
    {
        if (!is_array($fields)) {
            $fields = explode(",", $fields);
        }

        $orderBy = "";

        foreach ($fields as $field) {
            if (!$field = trim($field)) {
                continue;
            }
            if (!$orderBy) {
                $orderBy = "ORDER BY ";
            } else {
                $orderBy .= ", ";
            }

            if (strpos($field, " ")) {
                $orderBy .= $field;
            } else {
                $orderBy .= $this->quoteField($field);
            }
        }

        return $orderBy;
    }
public function orderBy ( $ fields ) { if ( ! is_array ( $ fields ) ) { $ fields = explode ( "," , $ fields ) ; } $ orderBy = "" ; foreach ( $ fields as $ field ) { if ( ! $ field = trim ( $ field ) ) { continue ; } if ( ! $ orderBy ) { $ orderBy = "ORDER BY " ; } else { $ orderBy .= ", " ; } if ( strpos ( $ field , " " ) ) { $ orderBy .= $ field ; } else { $ orderBy .= $ this -> quoteField ( $ field ) ; } } return $ orderBy ; }
Create an order by clause from a string of fields or an array of fields
Create an order by clause from a string of fields or an array of fields