PDO Delete Batch Function batch delete database operation using GOModel


GOModel batch delete function provides a simplest way to delete the batch of data from database. You need to pass table name from which you need to delete data and specify where condition to select records to be deleted. Please note that you must set where condition to delete specific data else all data will be deleted.

Function Defination

                                void function deleteBatch($dbTableName, $where = array());

Parameters Details

Details Type Example
$dbTableName - Table name to delete records string Any table name like "orderTable", "wp_posts" etc
$where - where condition string $where = array(array("empId",70), array("empId",71));


                                $GOModel = new GOModel(); //create object of the GOModel class
                                $GOModel->connect("localhost", "root", "", "database");//connect to database
                                /* Delete batch function */
                                //Example 1
                                $where = array(array("empId",70), array("empId",71));

More Examples

                                //Example 1
                                 $where = array(array("empId",70), array("empId",71));


Record will be deleted in database


Option Details Example
$GOModel->getLastQuery(); Return last query executed DELETE FROM `emp` WHERE `empId`= ?
print_r($GOModel->error) Print errors (if any)
$GOModel->rowsChanged; Return Rows created/changed 1