Executes a delete statement with minimal SQL markup and is called from the objSQL class.
- The table name argument is required.
- The optional where argument allows you to limit which rows are deleted and only requires the column and its value. You can use any of the normal operators used in SQL statements:
- "location IN ('Athens','London')"
- "location='Valdosta' AND dept='IT'"
- "salary BETWEEN 20000 AND 40000"
- obj_delete will delete all records from a database table if used without a where clause and steps should be taken in any script or program to utilize a confirmation before executing this method.
mixed obj_delete ( str table[, str where ] )
Result resource/object or false on failure.
$rs = $dbh->obj_delete( "mytable", "dept='IT'" );
if ( $dbh->obj_error() )
throw new Exception( $dbh->obj_error_message() );
catch ( Exception $e )
//log error and/or redirect user to error page
See also: obj_insert, obj_paging, obj_query, obj_select, obj_update