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