trOnGAtE

The 'Delete' Method
The 'Delete' method deletes a row from a database table. It accepts the following parameters:
- $id (required) - an integer, representing the 'id' value for the record that you would like to delete.
- $target_table (optional) - the name of the database table where the delete command is to be applied. By default, the Model will assume the target table to be equal to the value on the first URL segment.
What Gets Returned?
The 'Delete' method does not return anything.
Example 1
The syntax below shows the simplest Delete example possible. Here we are passing in the 'id' of the record that we would like to delete.
$this->model->delete(6);
The code above will produce the following SQL query:
DELETE from ` tablename` WHERE id = 6
Below is an example of a Members.php controller file that contains a test() method. Here we're invoking a basic 'Delete' command and then immediately displaying the results using Trongate's json() method:
<?php
class Members extends Trongate {
function test() {
$this->model->delete(6);
}
Below shows an example of the kind of output that we can expect to see from the above method, when Debug Mode is switched on:

Example 2
Below is a more advanced example:
$this->model->delete(7, 'members');
The code above would produce the following SQL query:
DELETE from ` tablename` WHERE id = 7
HELP & SUPPORT
If you have a question or a comment relating to anything you've see here, please goto the Help Bar.