All pastes #922879 Raw Edit

Anonymous

public php v1 · immutable
#922879 ·published 2008-02-29 02:14 UTC
rendered paste body
    public function select($table, $where, $order='', $desc=false, $limit=0, $offset=0)    {        $separator = '';        $conditions = '';        foreach ($where as $column => $value)        {            $conditions .= $separator.$column.'='.$this->quote($value);            $separator = ' AND ';        }        $query = "SELECT * FROM $table WHERE $conditions";        if (!empty($order))            $query .= " ORDER BY $order";        if ($desc)            $query .= " DESC";        if ($limit > 0)            $query .= " LIMIT $offset, $limit";        return $this->query($query);    }