mirror of
https://github.com/dg/dibi.git
synced 2025-08-29 16:59:49 +02:00
- BC change: DibiResult::fetchAll() returns always multidimensional arrays (for single columns use fetchPairs() instead)
- added DibiTable::insertOrUpdate() - new modifier %by
This commit is contained in:
@@ -31,7 +31,7 @@ class Products extends DibiTable
|
||||
|
||||
|
||||
// create table object
|
||||
$products = new Products();
|
||||
$products = new Products;
|
||||
|
||||
echo "Table name: $products->name\n";
|
||||
echo "Primary key: $products->primary\n";
|
||||
@@ -83,6 +83,13 @@ $id = $products->insert($data);
|
||||
var_dump($id); // generated id
|
||||
|
||||
|
||||
// inserts or updates row into a table
|
||||
$data = array();
|
||||
$data['title'] = 'New product';
|
||||
$data[$products->primary] = 5;
|
||||
$products->insertOrUpdate($data);
|
||||
|
||||
|
||||
// is absolutely SQL injection safe
|
||||
$key = '3 OR 1=1';
|
||||
$products->delete($key);
|
||||
|
Reference in New Issue
Block a user