[WORKING] mosDBTable->delete

Last reviewed: Not reviewed
phpDocumentor

mosDBTable->delete

Generic delete function. This method may be overridden/supplemented by the child class as required.

Note that the default method provided by mosDBTable does not check for dependancies so if your database structure is such that orphaned records are possible then you should consider calling mosDBTable->canDelete before this method or overriding this method with code that includes a call to mosDBTable->canDelete or equivalent functionality.

Syntax

string delete ( [ int $id ] )

$id
is the primary key index for the record to be deleted. This parameter is optional and if omitted will default to null.

Examples

Example: This example uses the myTable class defined on the mosDBTable class overview page.

global $database;
 
// Declare an instance of the myTable class.
$row = new myTable( $database );
 
// Delete the record with primary key $id.
if (!$row->delete( $id )) {
  mosErrorAlert( $row->getError());
}

Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Monday, 25 December 2006 )