PDO Delete Operation


Delete records in a table using associative array. Instead of writing long delete queries, you needs to pass associative array of conditions with keys as columns and value as column value. This function will automatically create query for you and deletes records.

Function Reference :
             	void dbDelete(string $table_name [, assoc. array $delete_where_condition=array()]) 


Name Type Required Parameter Info Example
table_name string Yes The name of the table to delete old records any table name like employee_table,user_table
delete_where_condition associative array Optional Associative array with key as column name and values as column value pass where condition to delete old row. array("userid"=>15)


 $sdb= new SimplifiedDB();


Old row will be deleted in table.


Debug Operation Result/Output
$sdb->query DELETE FROM user_roles WHERE `roleid`=?
$sdb->rows_affected 1
$sdb->message_info Connected to database

More Examples

              //Example of delete operation with where condition array as parameter
              //Delete operation without where condition, all rows will be deleted from that table