| @@ 1614-1636 (lines=23) @@ | ||
| 1611 | * |
|
| 1612 | * @return false|int false on error |
|
| 1613 | */ |
|
| 1614 | public function delete($table, $where) |
|
| 1615 | { |
|
| 1616 | ||
| 1617 | $table = trim($table); |
|
| 1618 | ||
| 1619 | if ($table === '') { |
|
| 1620 | $this->_displayError('invalid table name'); |
|
| 1621 | ||
| 1622 | return false; |
|
| 1623 | } |
|
| 1624 | ||
| 1625 | if (is_string($where)) { |
|
| 1626 | $WHERE = $this->escape($where, false, false); |
|
| 1627 | } elseif (is_array($where)) { |
|
| 1628 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1629 | } else { |
|
| 1630 | $WHERE = ''; |
|
| 1631 | } |
|
| 1632 | ||
| 1633 | $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1634 | ||
| 1635 | return $this->query($sql); |
|
| 1636 | } |
|
| 1637 | ||
| 1638 | /** |
|
| 1639 | * Execute a "select"-query. |
|
| @@ 1646-1666 (lines=21) @@ | ||
| 1643 | * |
|
| 1644 | * @return false|Result false on error |
|
| 1645 | */ |
|
| 1646 | public function select($table, $where = '1=1') |
|
| 1647 | { |
|
| 1648 | ||
| 1649 | if ($table === '') { |
|
| 1650 | $this->_displayError('invalid table name'); |
|
| 1651 | ||
| 1652 | return false; |
|
| 1653 | } |
|
| 1654 | ||
| 1655 | if (is_string($where)) { |
|
| 1656 | $WHERE = $this->escape($where, false, false); |
|
| 1657 | } elseif (is_array($where)) { |
|
| 1658 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1659 | } else { |
|
| 1660 | $WHERE = ''; |
|
| 1661 | } |
|
| 1662 | ||
| 1663 | $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1664 | ||
| 1665 | return $this->query($sql); |
|
| 1666 | } |
|
| 1667 | ||
| 1668 | /** |
|
| 1669 | * Get the last sql-error. |
|