Commit 18539075 authored by Alexander Butenko's avatar Alexander Butenko

Merge pull request #369 from avbdr/master

fixes
parents 5b3c0ce6 555fcb70
......@@ -660,10 +660,11 @@ class MysqliDb
*
* @param string $tableName The name of the database table to work with.
* @param array $tableData Array of data to update the desired row.
* @param int $numRows Limit on the number of rows that can be updated.
*
* @return bool
*/
public function update($tableName, $tableData)
public function update($tableName, $tableData, $numRows = null)
{
if ($this->isSubQuery) {
return;
......@@ -671,7 +672,7 @@ class MysqliDb
$this->_query = "UPDATE " . self::$prefix . $tableName;
$stmt = $this->_buildQuery(null, $tableData);
$stmt = $this->_buildQuery($numRows, $tableData);
$status = $stmt->execute();
$this->reset();
$this->_stmtError = $stmt->error;
......
......@@ -152,6 +152,12 @@ else
echo 'update failed: ' . $db->getLastError();
```
`update()` also support limit parameter:
```php
$db->update ('users', $data, 10);
// Gives: UPDATE users SET ... LIMIT 10
```
### Select Query
After any select/get function calls amount or returned rows is stored in $count variable
```php
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment