| @@ 1631-1653 (lines=23) @@ | ||
| 1628 | * |
|
| 1629 | * @return false|int false on error |
|
| 1630 | */ |
|
| 1631 | public function delete($table, $where) |
|
| 1632 | { |
|
| 1633 | ||
| 1634 | $table = trim($table); |
|
| 1635 | ||
| 1636 | if ($table === '') { |
|
| 1637 | $this->_displayError('invalid table name'); |
|
| 1638 | ||
| 1639 | return false; |
|
| 1640 | } |
|
| 1641 | ||
| 1642 | if (is_string($where)) { |
|
| 1643 | $WHERE = $this->escape($where, false, false); |
|
| 1644 | } elseif (is_array($where)) { |
|
| 1645 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1646 | } else { |
|
| 1647 | $WHERE = ''; |
|
| 1648 | } |
|
| 1649 | ||
| 1650 | $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1651 | ||
| 1652 | return $this->query($sql); |
|
| 1653 | } |
|
| 1654 | ||
| 1655 | /** |
|
| 1656 | * Execute a "select"-query. |
|
| @@ 1663-1683 (lines=21) @@ | ||
| 1660 | * |
|
| 1661 | * @return false|Result false on error |
|
| 1662 | */ |
|
| 1663 | public function select($table, $where = '1=1') |
|
| 1664 | { |
|
| 1665 | ||
| 1666 | if ($table === '') { |
|
| 1667 | $this->_displayError('invalid table name'); |
|
| 1668 | ||
| 1669 | return false; |
|
| 1670 | } |
|
| 1671 | ||
| 1672 | if (is_string($where)) { |
|
| 1673 | $WHERE = $this->escape($where, false, false); |
|
| 1674 | } elseif (is_array($where)) { |
|
| 1675 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1676 | } else { |
|
| 1677 | $WHERE = ''; |
|
| 1678 | } |
|
| 1679 | ||
| 1680 | $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1681 | ||
| 1682 | return $this->query($sql); |
|
| 1683 | } |
|
| 1684 | ||
| 1685 | /** |
|
| 1686 | * Get the last sql-error. |
|