db\Command insert()

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

doc_Yii
2016-10-30 16:57:27
Comments
Leave a Comment

Please login to continue.