File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
user_guide_src/source/models Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -311,13 +311,15 @@ Saving Data
311
311
insert()
312
312
--------
313
313
314
- An associative array of data is passed into this method as the only parameter to create a new
315
- row of data in the database. The array's keys must match the name of the columns in a ``$table ``, while
316
- the array's values are the values to save for that key:
314
+ The first parametre is an associative array of data to create a new row of data in the database.
315
+ If an object is passed instead of an array, it will attempt to convert it to an array.
316
+
317
+ The array's keys must match the name of the columns in the ```$table` ``, while the array's values are the values to save for that key:
317
318
318
319
.. literalinclude :: model/015.php
319
320
320
- You can retrieve the last inserted row's primary key using the ``getInsertID() `` method.
321
+ The second parametre is of type boolean which determines whether an insert ID should be returned.
322
+ If it is omitted, then the default return value is the insert id.
321
323
322
324
update()
323
325
--------
Original file line number Diff line number Diff line change 5
5
'email ' => 'd.vader@theempire.com ' ,
6
6
];
7
7
8
- $ userModel ->insert ($ data );
8
+ $ userModel ->insert ($ data, bool $ returnID = true );
You can’t perform that action at this time.
0 commit comments