PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- class request_db extends db {
- # My table
- public $from;
- #order
- public $order = false;
- public $whereby = false;
- # limit
- public $start = 0;
- public $finish = 1;
- # request
- public $while = false;
- public $select = false;
- public $group_by = false;
- public function select() {
- if ($this -> from != false) {
- if ($this -> select != false) {
- $this -> request = "SELECT " . $this -> select . " FROM ";
- } else {
- $this -> request = "SELECT * FROM ";
- }
- if ($this -> while != false) {
- $this -> request .= " WHERE " . $this -> while . " ";
- }
- if ($this -> group_by != false) {
- $this -> request .= " GROUP BY " . $this -> $group_by . " ";
- }
- if ($this -> order != false) {
- $this -> request .= " ORDER BY " . $this -> $order . " ";
- if ($this -> whereby != false) {
- $this -> request .= $this -> whereby;
- }
- }
- $this -> request .= "LIMIT {$this -> start}, {$this -> finish};";
- return $this -> getAssocArr($this -> query($this -> request));
- }
- return 'no table';
- }
- }