insert() public method
Creates an INSERT command.
For example,
$connection->createCommand()->insert('user', [
'name' => 'Sam',
'age' => 30,
])->execute();
The method will properly escape the column names, and bind the values to be inserted.
Note that the created command is not executed until execute() is called.
| public $this insert ( $table, $columns ) | ||
|---|---|---|
| $table | string |
The table that new rows will be inserted into. |
| $columns | array |
The column data (name => value) to be inserted into the table. |
| return | $this |
The command object itself |
Please login to continue.