File tree Expand file tree Collapse file tree
user_guide_src/source/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -311,13 +311,15 @@ Saving Data
311311insert()
312312--------
313313
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:
317318
318319.. literalinclude :: model/015.php
319320
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.
321323
322324update()
323325--------
Original file line number Diff line number Diff line change 55 'email ' => 'd.vader@theempire.com ' ,
66];
77
8- $ userModel ->insert ($ data );
8+ $ userModel ->insert ($ data, bool $ returnID = true );
You can’t perform that action at this time.
0 commit comments