We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
###A Simple insert Inserting data into a table is very easy:
// Select the table $table = db('mytable'); // Query the database $table->insert(array( 'user'=>'Evan', 'email'=>'not_real@gmail.com' ));
The above is the same as the following SQL:
INSERT INTO `mytable` (`user`,`email`) VALUES ('Evan','not_real@gmail.com')
Note that the values 'Evan' and 'not_real@gmail.com' are automatically cleaned of any possible SQL Injections.
Insert also returns the new row inserted:
$row = $table->insert(array( 'user'=>'Evan', 'email'=>'not_real@gmail.com' )); // Get the value of the AUTO_INCREMENTING column echo $row->id;
This functionality can be disabled in order to improve peformance by setting the optional second argument to FALSE.
FALSE
$table->insert(array( 'user'=>'Evan', 'email'=>'not_real@gmail.com' ),FALSE);