File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -660,18 +660,19 @@ public function has($tableName)
660660 *
661661 * @param string $tableName The name of the database table to work with.
662662 * @param array $tableData Array of data to update the desired row.
663+ * @param int $numRows Limit on the number of rows that can be updated.
663664 *
664665 * @return bool
665666 */
666- public function update ($ tableName , $ tableData )
667+ public function update ($ tableName , $ tableData, $ numRows = null )
667668 {
668669 if ($ this ->isSubQuery ) {
669670 return ;
670671 }
671672
672673 $ this ->_query = "UPDATE " . self ::$ prefix . $ tableName ;
673674
674- $ stmt = $ this ->_buildQuery (null , $ tableData );
675+ $ stmt = $ this ->_buildQuery ($ numRows , $ tableData );
675676 $ status = $ stmt ->execute ();
676677 $ this ->reset ();
677678 $ this ->_stmtError = $ stmt ->error ;
Original file line number Diff line number Diff line change @@ -152,6 +152,12 @@ else
152152 echo 'update failed: ' . $db->getLastError();
153153```
154154
155+ ` update() ` also support limit parameter:
156+ ``` php
157+ $db->update ('users', $data, 10);
158+ // Gives: UPDATE users SET ... LIMIT 10
159+ ```
160+
155161### Select Query
156162After any select/get function calls amount or returned rows is stored in $count variable
157163``` php
You can’t perform that action at this time.
0 commit comments