db_delete_records

bool db_delete_records (string tablename, idarray [, idfield])

Deletes records in a table.

Arguments

tablename is the name of the table that will be affected. If it is null, the function affects the last accessed table.
idarray holds the ids of the records to be deleted.
idfield is the name of identifier field (column). Default is "id".

Result

The function returns TRUE if successful or FALSE otherwise.

Example

// Deletes 3 records with the id 1,3,5

$idarray = array(1,3,5);
$result = db_delete_records("mytable",$idarray);
if $result {
echo "records deleted";
}


See also

Database functions
Database support