| @@ 1574-1596 (lines=23) @@ | ||
| 1571 | * |
|
| 1572 | * @return false|int false on error |
|
| 1573 | */ |
|
| 1574 | public function delete($table, $where) |
|
| 1575 | { |
|
| 1576 | ||
| 1577 | $table = trim($table); |
|
| 1578 | ||
| 1579 | if ($table === '') { |
|
| 1580 | $this->_displayError('invalid table name'); |
|
| 1581 | ||
| 1582 | return false; |
|
| 1583 | } |
|
| 1584 | ||
| 1585 | if (is_string($where)) { |
|
| 1586 | $WHERE = $this->escape($where, false, false); |
|
| 1587 | } elseif (is_array($where)) { |
|
| 1588 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1589 | } else { |
|
| 1590 | $WHERE = ''; |
|
| 1591 | } |
|
| 1592 | ||
| 1593 | $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1594 | ||
| 1595 | return $this->query($sql); |
|
| 1596 | } |
|
| 1597 | ||
| 1598 | /** |
|
| 1599 | * select |
|
| @@ 1606-1626 (lines=21) @@ | ||
| 1603 | * |
|
| 1604 | * @return false|Result false on error |
|
| 1605 | */ |
|
| 1606 | public function select($table, $where = '1=1') |
|
| 1607 | { |
|
| 1608 | ||
| 1609 | if ($table === '') { |
|
| 1610 | $this->_displayError('invalid table name'); |
|
| 1611 | ||
| 1612 | return false; |
|
| 1613 | } |
|
| 1614 | ||
| 1615 | if (is_string($where)) { |
|
| 1616 | $WHERE = $this->escape($where, false, false); |
|
| 1617 | } elseif (is_array($where)) { |
|
| 1618 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1619 | } else { |
|
| 1620 | $WHERE = ''; |
|
| 1621 | } |
|
| 1622 | ||
| 1623 | $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1624 | ||
| 1625 | return $this->query($sql); |
|
| 1626 | } |
|
| 1627 | ||
| 1628 | /** |
|
| 1629 | * get the last error |
|