Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Database API > Methods

Database API: Delete

Scroll Prev Next More

 

Deletes records from a database. The second parameter must be specified for the method to be executed successfully.

Syntax

DB::Delete($table, $values)
// or
DB::Delete($table, $where)

Arguments

$table

the table from which the data is deleted.

$values

an array with values that define the condition for the delete query.

$where

the condition for the query; if unspecified, no action will be done.

Return value

No return value.

Example

// delete from Cars where id=50
 
$data = array();
$data["id"] = 50;
DB::Delete("cars", $data );

 

Alternative syntax:

 

// delete from Cars where id=50
 
DB::Delete("cars", "id=50" );

 

See also:

Database API: Insert()

Database API: Update()

Database API: Select()

About Database API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software