| @@ 1349-1371 (lines=23) @@ | ||
| 1346 | * |
|
| 1347 | * @return false|int false on error |
|
| 1348 | */ |
|
| 1349 | public function delete($table, $where) |
|
| 1350 | { |
|
| 1351 | ||
| 1352 | $table = trim($table); |
|
| 1353 | ||
| 1354 | if ($table === '') { |
|
| 1355 | $this->_debug->displayError('invalid table name'); |
|
| 1356 | ||
| 1357 | return false; |
|
| 1358 | } |
|
| 1359 | ||
| 1360 | if (is_string($where)) { |
|
| 1361 | $WHERE = $this->escape($where, false); |
|
| 1362 | } elseif (is_array($where)) { |
|
| 1363 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1364 | } else { |
|
| 1365 | $WHERE = ''; |
|
| 1366 | } |
|
| 1367 | ||
| 1368 | $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1369 | ||
| 1370 | return $this->query($sql); |
|
| 1371 | } |
|
| 1372 | ||
| 1373 | /** |
|
| 1374 | * Execute a "select"-query. |
|
| @@ 1381-1401 (lines=21) @@ | ||
| 1378 | * |
|
| 1379 | * @return false|Result false on error |
|
| 1380 | */ |
|
| 1381 | public function select($table, $where = '1=1') |
|
| 1382 | { |
|
| 1383 | ||
| 1384 | if ($table === '') { |
|
| 1385 | $this->_debug->displayError('invalid table name'); |
|
| 1386 | ||
| 1387 | return false; |
|
| 1388 | } |
|
| 1389 | ||
| 1390 | if (is_string($where)) { |
|
| 1391 | $WHERE = $this->escape($where, false); |
|
| 1392 | } elseif (is_array($where)) { |
|
| 1393 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1394 | } else { |
|
| 1395 | $WHERE = ''; |
|
| 1396 | } |
|
| 1397 | ||
| 1398 | $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1399 | ||
| 1400 | return $this->query($sql); |
|
| 1401 | } |
|
| 1402 | ||
| 1403 | /** |
|
| 1404 | * Get the last sql-error. |
|