Delete Query

Delete Query:- It is used to delete record from the custom table.

Syntax:-


$write_connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$where = array($write_connection ->quoteInto('tableId =?', table_id));
$write_connection->delete('tablename',$where);

Example:- Suppose, you have to delete records of the employee table which has employee’s 1.


$write_connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$where = array($write_connection ->quoteInto('tableId =?', '1'));
$write_connection->delete('employee',$where);