{"id":3393,"date":"2018-08-01T18:49:45","date_gmt":"2018-08-01T18:49:45","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=3393"},"modified":"2018-08-01T18:51:29","modified_gmt":"2018-08-01T18:51:29","slug":"delete-multiple-records-from-database-in-codeigniter","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/","title":{"rendered":"Delete Multiple Records from Database in CodeIgniter"},"content":{"rendered":"<p><b>Delete multiple records<\/b> on a single click is very useful for the large data list. This feature provides a user-friendly way to remove multiple records from the database quickly. The user doesn&#8217;t need to click multiple times for delete multiple rows, instead of that, all records can be deleted on a single click.<\/p>\n<p>Multiple records deletion functionality can be easily implemented using checkboxes. You can use the checkbox to select each record in the data list and delete all the selected records from the database. Also, the <b>Select \/ Deselect all checkboxes<\/b> feature will make it easy to select multiple records because it allows the user to check or uncheck all rows at once. In this tutorial, we will show you how to <b>delete multiple records from database using checkbox<\/b> in CodeIgniter.<\/p>\n<p>The example code, the following steps will be followed to <b>delete multiple records from database in CodeIgniter<\/b>.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Retrieve all users data from the MySQL database and list them in an HTML table.<\/li>\n<li>Attach checkbox to each row to select multiple records.<\/li>\n<li>Add a checkbox in the table header to check or uncheck all checkboxes on a single click.<\/li>\n<li>Delete button to remove all checked rows from users table in the MySQL database.<\/li>\n<\/ul>\n<h2>Create Database Table<\/h2>\n<p>To store the user&#8217;s data a table needs to be created in the database. The following SQL creates a <code>users<\/code> table with some basic fields in the MySQL database.<\/p>\n<pre><span style=\"color: rgb(149, 65, 33);\">CREATE<\/span> <span style=\"color: rgb(149, 65, 33);\">TABLE<\/span> <span style=\"color: rgb(33, 145, 97);\">`users`<\/span> (\r\n <span style=\"color: rgb(33, 145, 97);\">`id`<\/span> <span style=\"color: rgb(0, 134, 179);\">int<\/span>(<span style=\"color: rgb(64, 160, 112);\">11<\/span>) <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span> AUTO_INCREMENT,\r\n <span style=\"color: rgb(33, 145, 97);\">`first_name`<\/span> <span style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span style=\"color: rgb(64, 160, 112);\">100<\/span>) <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`last_name`<\/span> <span style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span style=\"color: rgb(64, 160, 112);\">100<\/span>) <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`email`<\/span> <span style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span style=\"color: rgb(64, 160, 112);\">200<\/span>) <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`phone`<\/span> <span style=\"color: rgb(0, 134, 179);\">varchar<\/span>(<span style=\"color: rgb(64, 160, 112);\">15<\/span>) <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span> utf8_unicode_ci <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`created`<\/span> datetime <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`modified`<\/span> datetime <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span>,\r\n <span style=\"color: rgb(33, 145, 97);\">`status`<\/span> tinyint(<span style=\"color: rgb(64, 160, 112);\">1<\/span>) <span style=\"color: rgb(149, 65, 33);\">NOT<\/span> <span style=\"color: rgb(149, 65, 33);\">NULL<\/span> <span style=\"color: rgb(149, 65, 33);\">DEFAULT<\/span> <span style=\"color: rgb(33, 145, 97);\">'1'<\/span> <span style=\"color: rgb(149, 65, 33);\">COMMENT<\/span> <span style=\"color: rgb(33, 145, 97);\">'1=Active, 0=Deactive'<\/span>,\r\n PRIMARY <span style=\"color: rgb(149, 65, 33);\">KEY<\/span> (<span style=\"color: rgb(33, 145, 97);\">`id`<\/span>)\r\n) <span style=\"color: rgb(149, 65, 33);\">ENGINE<\/span>=<span style=\"color: rgb(149, 65, 33);\">InnoDB<\/span> <span style=\"color: rgb(149, 65, 33);\">DEFAULT<\/span> <span style=\"color: rgb(149, 65, 33);\">CHARSET<\/span>=utf8 <span style=\"color: rgb(149, 65, 33);\">COLLATE<\/span>=utf8_unicode_ci;<\/pre>\n<h2>Controller (Users.php)<\/h2>\n<p>The Users controller contains 2 functions, <code>__construct()<\/code> and <code>index()<\/code>.<br \/>\n<b>__construct()<\/b> &#8211; Load the User model to fetch data from the database.<\/p>\n<p><b>index()<\/b> &#8211;<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Fetch users data from the database using <code>getRows()<\/code> function of the User model.<\/li>\n<li>Pass the user data to view and load this view.<\/li>\n<li>If the delete request is submitted:\n<ul>\n<li>Get selected rows ID using $_POST in PHP.<\/li>\n<li>Check whether the user select at least one records and the ID array is not empty.<\/li>\n<li>Based on the selected user&#8217;s ID, delete records from the database using <code>delete()<\/code> function of the User model.<\/li>\n<\/ul>\n<\/li>\n<li>Pass the status message to the view.<\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php&nbsp;defined<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'BASEPATH'<\/span><span style=\"color: #007700\">)&nbsp;OR&nbsp;exit(<\/span><span style=\"color: #DD0000\">'No&nbsp;direct&nbsp;script&nbsp;access&nbsp;allowed'<\/span><span style=\"color: #007700\">);<br \/><br \/>class&nbsp;<\/span><span style=\"color: #0000BB\">Users&nbsp;<\/span><span style=\"color: #007700\">extends&nbsp;<\/span><span style=\"color: #0000BB\">CI_Controller&nbsp;<\/span><span style=\"color: #007700\">{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">__construct<\/span><span style=\"color: #007700\">()&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">parent<\/span><span style=\"color: #007700\">::<\/span><span style=\"color: #0000BB\">__construct<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Load&nbsp;user&nbsp;model<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">load<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">model<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'user'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">index<\/span><span style=\"color: #007700\">(){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$data&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;If&nbsp;record&nbsp;delete&nbsp;request&nbsp;is&nbsp;submitted<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if(<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">input<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">post<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'bulk_delete_submit'<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Get&nbsp;all&nbsp;selected&nbsp;IDs<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$ids&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">input<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">post<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'checked_id'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;If&nbsp;id&nbsp;array&nbsp;is&nbsp;not&nbsp;empty<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if(!empty(<\/span><span style=\"color: #0000BB\">$ids<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Delete&nbsp;records&nbsp;from&nbsp;the&nbsp;database<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$delete&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">delete<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ids<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;If&nbsp;delete&nbsp;is&nbsp;successful<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if(<\/span><span style=\"color: #0000BB\">$delete<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$data<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'statusMsg'<\/span><span style=\"color: #007700\">]&nbsp;=&nbsp;<\/span><span style=\"color: #DD0000\">'Selected&nbsp;users&nbsp;have&nbsp;been&nbsp;deleted&nbsp;successfully.'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$data<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'statusMsg'<\/span><span style=\"color: #007700\">]&nbsp;=&nbsp;<\/span><span style=\"color: #DD0000\">'Some&nbsp;problem&nbsp;occurred,&nbsp;please&nbsp;try&nbsp;again.'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$data<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'statusMsg'<\/span><span style=\"color: #007700\">]&nbsp;=&nbsp;<\/span><span style=\"color: #DD0000\">'Select&nbsp;at&nbsp;least&nbsp;1&nbsp;record&nbsp;to&nbsp;delete.'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Get&nbsp;user&nbsp;data&nbsp;from&nbsp;the&nbsp;database<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$data<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'users'<\/span><span style=\"color: #007700\">]&nbsp;=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">getRows<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Pass&nbsp;the&nbsp;data&nbsp;to&nbsp;view<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">load<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">view<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'users\/index'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$data<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>}<\/span><\/pre>\n<h2>Model (User.php)<\/h2>\n<p>The User model handles the database related works.<\/p>\n<ul class=\"bullet_disk_list\">\n<li><b>__construct()<\/b> \u2013 Specify the table name of the database.<\/li>\n<li><b>getRows()<\/b> \u2013 Fetch the records from the <code>users<\/code> table based on the specified conditions and returns as an array.<\/li>\n<li><b>delete()<\/b> &#8211; Delete records from the <code>users<\/code> table based on the specified ID.<\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">if&nbsp;(&nbsp;!&nbsp;<\/span><span style=\"color: #0000BB\">defined<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'BASEPATH'<\/span><span style=\"color: #007700\">))&nbsp;exit(<\/span><span style=\"color: #DD0000\">'No&nbsp;direct&nbsp;script&nbsp;access&nbsp;allowed'<\/span><span style=\"color: #007700\">);<br \/><br \/>class&nbsp;<\/span><span style=\"color: #0000BB\">User&nbsp;<\/span><span style=\"color: #007700\">extends&nbsp;<\/span><span style=\"color: #0000BB\">CI_Model<\/span><span style=\"color: #007700\">{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">__construct<\/span><span style=\"color: #007700\">()&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">tblName&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'users'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/*<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Fetch&nbsp;posts&nbsp;data&nbsp;from&nbsp;the&nbsp;database<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;id&nbsp;returns&nbsp;a&nbsp;single&nbsp;record&nbsp;if&nbsp;specified,&nbsp;otherwise&nbsp;all&nbsp;records<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">function&nbsp;<\/span><span style=\"color: #0000BB\">getRows<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$params&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array()){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">select<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'*'<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">from<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">tblName<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/fetch&nbsp;data&nbsp;by&nbsp;conditions<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if(<\/span><span style=\"color: #0000BB\">array_key_exists<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"where\"<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'where'<\/span><span style=\"color: #007700\">]&nbsp;as&nbsp;<\/span><span style=\"color: #0000BB\">$key&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">$value<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">where<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$key<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$value<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">array_key_exists<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"order_by\"<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">order_by<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'order_by'<\/span><span style=\"color: #007700\">]);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">array_key_exists<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"id\"<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">where<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">]);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$query&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">get<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$result&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$query<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">row_array<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/set&nbsp;start&nbsp;and&nbsp;limit<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if(<\/span><span style=\"color: #0000BB\">array_key_exists<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"start\"<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">)&nbsp;&amp;&amp;&nbsp;<\/span><span style=\"color: #0000BB\">array_key_exists<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"limit\"<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">limit<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'limit'<\/span><span style=\"color: #007700\">],<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'start'<\/span><span style=\"color: #007700\">]);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}elseif(!<\/span><span style=\"color: #0000BB\">array_key_exists<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"start\"<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">)&nbsp;&amp;&amp;&nbsp;<\/span><span style=\"color: #0000BB\">array_key_exists<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"limit\"<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">limit<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'limit'<\/span><span style=\"color: #007700\">]);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">array_key_exists<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"returnType\"<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">)&nbsp;&amp;&amp;&nbsp;<\/span><span style=\"color: #0000BB\">$params<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'returnType'<\/span><span style=\"color: #007700\">]&nbsp;==&nbsp;<\/span><span style=\"color: #DD0000\">'count'<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$result&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">count_all_results<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$query&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">get<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$result&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;(<\/span><span style=\"color: #0000BB\">$query<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">num_rows<\/span><span style=\"color: #007700\">()&nbsp;&gt;&nbsp;<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">)?<\/span><span style=\"color: #0000BB\">$query<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">result_array<\/span><span style=\"color: #007700\">():<\/span><span style=\"color: #0000BB\">FALSE<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/return&nbsp;fetched&nbsp;data<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">return&nbsp;<\/span><span style=\"color: #0000BB\">$result<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/*<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Delete&nbsp;data&nbsp;from&nbsp;the&nbsp;database<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;id&nbsp;array\/int<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">delete<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$id<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">is_array<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$id<\/span><span style=\"color: #007700\">)){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">where_in<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$id<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">where<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$id<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$delete&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">db<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">delete<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">tblName<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">$delete<\/span><span style=\"color: #007700\">?<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">:<\/span><span style=\"color: #0000BB\">false<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>}<\/span><\/pre>\n<h2>View (users\/index.php)<\/h2>\n<p>The jQuery is used to show the delete confirmation dialog and integrate select all checkboxes functionality. So, include the jQuery library first.<\/p>\n<pre><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">script<\/span> <span>src<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.3.1\/jquery.min.js\"<\/span>&gt;<\/span><span><\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span><\/pre>\n<p>The following jQuery is used for confirmation dialog and select all checkboxes functionality.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>The <code>delete_confirm()<\/code> function checks whether the user selects at least one checkbox and display an alert or confirmation dialog before submitting the form to Users controller for delete multiple records.<\/li>\n<li>The <a href=\"https:\/\/www.codexworld.com\/select-deselect-all-checkboxes-using-jquery\/\">Select \/ Deselect All CheckBoxes using jQuery<\/a> helps the user to check \/ uncheck all checkboxes on a single click.<\/li>\n<\/ul>\n<pre><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span>\r\n<span><span style=\"color: rgb(184, 84, 212);\">function<\/span> <span style=\"color: rgb(102, 132, 225);\">delete_confirm<\/span>(<span style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n    <span style=\"color: rgb(184, 84, 212);\">if<\/span>($(<span style=\"color: rgb(96, 172, 57);\">'.checkbox:checked'<\/span>).length &gt; <span style=\"color: rgb(182, 86, 17);\">0<\/span>){\r\n        <span style=\"color: rgb(184, 84, 212);\">var<\/span> result = confirm(<span style=\"color: rgb(96, 172, 57);\">\"Are you sure to delete selected users?\"<\/span>);\r\n        <span style=\"color: rgb(184, 84, 212);\">if<\/span>(result){\r\n            <span style=\"color: rgb(184, 84, 212);\">return<\/span> <span style=\"color: rgb(182, 86, 17);\">true<\/span>;\r\n        }<span style=\"color: rgb(184, 84, 212);\">else<\/span>{\r\n            <span style=\"color: rgb(184, 84, 212);\">return<\/span> <span style=\"color: rgb(182, 86, 17);\">false<\/span>;\r\n        }\r\n    }<span style=\"color: rgb(184, 84, 212);\">else<\/span>{\r\n        alert(<span style=\"color: rgb(96, 172, 57);\">'Select at least 1 record to delete.'<\/span>);\r\n        <span style=\"color: rgb(184, 84, 212);\">return<\/span> <span style=\"color: rgb(182, 86, 17);\">false<\/span>;\r\n    }\r\n}\r\n\r\n$(<span style=\"color: rgb(182, 86, 17);\">document<\/span>).ready(<span><span style=\"color: rgb(184, 84, 212);\">function<\/span>(<span style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n    $(<span style=\"color: rgb(96, 172, 57);\">'#select_all'<\/span>).on(<span style=\"color: rgb(96, 172, 57);\">'click'<\/span>,<span><span style=\"color: rgb(184, 84, 212);\">function<\/span>(<span style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n        <span style=\"color: rgb(184, 84, 212);\">if<\/span>(<span style=\"color: rgb(184, 84, 212);\">this<\/span>.checked){\r\n            $(<span style=\"color: rgb(96, 172, 57);\">'.checkbox'<\/span>).each(<span><span style=\"color: rgb(184, 84, 212);\">function<\/span>(<span style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n                <span style=\"color: rgb(184, 84, 212);\">this<\/span>.checked = <span style=\"color: rgb(182, 86, 17);\">true<\/span>;\r\n            });\r\n        }<span style=\"color: rgb(184, 84, 212);\">else<\/span>{\r\n             $(<span style=\"color: rgb(96, 172, 57);\">'.checkbox'<\/span>).each(<span><span style=\"color: rgb(184, 84, 212);\">function<\/span>(<span style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n                <span style=\"color: rgb(184, 84, 212);\">this<\/span>.checked = <span style=\"color: rgb(182, 86, 17);\">false<\/span>;\r\n            });\r\n        }\r\n    });\r\n\t\r\n    $(<span style=\"color: rgb(96, 172, 57);\">'.checkbox'<\/span>).on(<span style=\"color: rgb(96, 172, 57);\">'click'<\/span>,<span><span style=\"color: rgb(184, 84, 212);\">function<\/span>(<span style=\"color: rgb(182, 86, 17);\"><\/span>)<\/span>{\r\n        <span style=\"color: rgb(184, 84, 212);\">if<\/span>($(<span style=\"color: rgb(96, 172, 57);\">'.checkbox:checked'<\/span>).length == $(<span style=\"color: rgb(96, 172, 57);\">'.checkbox'<\/span>).length){\r\n            $(<span style=\"color: rgb(96, 172, 57);\">'#select_all'<\/span>).prop(<span style=\"color: rgb(96, 172, 57);\">'checked'<\/span>,<span style=\"color: rgb(182, 86, 17);\">true<\/span>);\r\n        }<span style=\"color: rgb(184, 84, 212);\">else<\/span>{\r\n            $(<span style=\"color: rgb(96, 172, 57);\">'#select_all'<\/span>).prop(<span style=\"color: rgb(96, 172, 57);\">'checked'<\/span>,<span style=\"color: rgb(182, 86, 17);\">false<\/span>);\r\n        }\r\n    });\r\n});\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">script<\/span>&gt;<\/span>\r\n<\/pre>\n<p>Initially, all the records from the users table are listed in an HTML table. The user can select single or multiple rows in the table and <b>delete multiple records from the MySQL database in CodeIgniter<\/b> application.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>All the user&#8217;s data are retrieved from the database.<\/li>\n<li>Multiple rows can be selected using checkbox provided on each table row.<\/li>\n<li>By clicking the checkbox in the table header, all checkboxes will be checked or unchecked.<\/li>\n<li>Once the delete button is clicked, a dialog will appear for the confirmation.<\/li>\n<li>After the confirmation, the form is submitted to delete selected records from the database.<\/li>\n<\/ul>\n<pre><span style=\"color: rgb(108, 107, 90);\">&lt;!-- Display the status message --&gt;<\/span>\r\n<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">if(!empty(<\/span><span style=\"color: #0000BB\">$statusMsg<\/span><span style=\"color: #007700\">)){&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">div<\/span> <span>class<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"alert alert-success\"<\/span>&gt;<\/span><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$statusMsg<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">div<\/span>&gt;<\/span>\r\n<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">}&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n\r\n<span style=\"color: rgb(108, 107, 90);\">&lt;!-- Users data list --&gt;<\/span>\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">form<\/span> <span>name<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"bulk_action_form\"<\/span> <span>action<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"\"<\/span> <span>method<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"post\"<\/span> <span>onSubmit<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"return delete_confirm();\"<\/span>\/&gt;<\/span>\r\n    <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">table<\/span> <span>class<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"bordered\"<\/span>&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">thead<\/span>&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span>\r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">input<\/span> <span>type<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"checkbox\"<\/span> <span>id<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"select_all\"<\/span> <span>value<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"\"<\/span>\/&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>        \r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>First Name<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Last Name<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Email<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>Phone<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">th<\/span>&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">thead<\/span>&gt;<\/span>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">if(!empty(<\/span><span style=\"color: #0000BB\">$users<\/span><span style=\"color: #007700\">)){&nbsp;foreach(<\/span><span style=\"color: #0000BB\">$users&nbsp;<\/span><span style=\"color: #007700\">as&nbsp;<\/span><span style=\"color: #0000BB\">$row<\/span><span style=\"color: #007700\">){&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span>\r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">td<\/span> <span>align<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"center\"<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">input<\/span> <span>type<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"checkbox\"<\/span> <span>name<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"checked_id[]\"<\/span> <span>class<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"checkbox\"<\/span> <span>value<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$row<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\"<\/span>\/&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span>        \r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$row<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'first_name'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span>\r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$row<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'last_name'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span>\r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$row<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'email'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span>\r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$row<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'phone'<\/span><span style=\"color: #007700\">];&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span>\r\n        <span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">}&nbsp;}else{&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n            <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">td<\/span> <span>colspan<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"5\"<\/span>&gt;<\/span>No records found.<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">td<\/span>&gt;<\/span><span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">tr<\/span>&gt;<\/span>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">}&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n    <span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">table<\/span>&gt;<\/span>\r\n    <span style=\"color: rgb(186, 98, 54);\">&lt;<span style=\"color: rgb(186, 98, 54);\">input<\/span> <span>type<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"submit\"<\/span> <span>class<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"btn btn-danger\"<\/span> <span>name<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"bulk_delete_submit\"<\/span> <span>value<\/span>=<span style=\"color: rgb(125, 151, 38);\">\"DELETE\"<\/span>\/&gt;<\/span>\r\n<span style=\"color: rgb(186, 98, 54);\">&lt;\/<span style=\"color: rgb(186, 98, 54);\">form<\/span>&gt;<\/span>\r\n<\/pre>\n<p class=\"seeAlso\"><span><\/span><a href=\"https:\/\/www.codexworld.com\/delete-multiple-records-from-mysql-in-php\/\">Delete Multiple Records from MySQL Database in PHP<\/a><\/span><\/p>\n<h2>Conclusion<\/h2>\n<p>If you want to make the data management section user-friendly, multiple delete is a must-have functionality for your CodeIgniter application. It provides an effective way to <b>delete multiple records in CodeIgniter<\/b>.  Using our example code, you can check\/uncheck all records at once, get multiple checked checkbox value in CodeIgniter and delete selected rows from the database on a single click.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Delete multiple records on a single click is very useful for the large data list. This feature provides a user-friendly way to remove multiple records from the database quickly. The user doesn&#8217;t need to click <\/p>\n","protected":false},"author":1,"featured_media":3396,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8],"tags":[55,98],"class_list":["post-3393","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codeigniter","tag-codeigniter","tag-database","cat-8-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Delete Multiple Records from Database in CodeIgniter - CodexWorld<\/title>\n<meta name=\"description\" content=\"Delete multiple records in CodeIgniter - Example code to delete multiple rows using checkbox in CodeIgniter. Select \/ Deselect all checkboxes and get multiple checked checkbox value in CodeIgniter.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Delete Multiple Records from Database in CodeIgniter - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Delete multiple records in CodeIgniter - Example code to delete multiple rows using checkbox in CodeIgniter. Select \/ Deselect all checkboxes and get multiple checked checkbox value in CodeIgniter.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-01T18:49:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-08-01T18:51:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/08\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Delete Multiple Records from Database in CodeIgniter\",\"datePublished\":\"2018-08-01T18:49:45+00:00\",\"dateModified\":\"2018-08-01T18:51:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/\"},\"wordCount\":648,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png\",\"keywords\":[\"CodeIgniter\",\"Database\"],\"articleSection\":[\"CodeIgniter\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/\",\"name\":\"Delete Multiple Records from Database in CodeIgniter - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png\",\"datePublished\":\"2018-08-01T18:49:45+00:00\",\"dateModified\":\"2018-08-01T18:51:29+00:00\",\"description\":\"Delete multiple records in CodeIgniter - Example code to delete multiple rows using checkbox in CodeIgniter. Select \\\/ Deselect all checkboxes and get multiple checked checkbox value in CodeIgniter.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/delete-multiple-records-from-database-in-codeigniter\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Delete Multiple Records from Database in CodeIgniter\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Delete Multiple Records from Database in CodeIgniter - CodexWorld","description":"Delete multiple records in CodeIgniter - Example code to delete multiple rows using checkbox in CodeIgniter. Select \/ Deselect all checkboxes and get multiple checked checkbox value in CodeIgniter.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/","og_locale":"en_US","og_type":"article","og_title":"Delete Multiple Records from Database in CodeIgniter - CodexWorld","og_description":"Delete multiple records in CodeIgniter - Example code to delete multiple rows using checkbox in CodeIgniter. Select \/ Deselect all checkboxes and get multiple checked checkbox value in CodeIgniter.","og_url":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2018-08-01T18:49:45+00:00","article_modified_time":"2018-08-01T18:51:29+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/08\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Delete Multiple Records from Database in CodeIgniter","datePublished":"2018-08-01T18:49:45+00:00","dateModified":"2018-08-01T18:51:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/"},"wordCount":648,"commentCount":0,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/08\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png","keywords":["CodeIgniter","Database"],"articleSection":["CodeIgniter"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/","url":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/","name":"Delete Multiple Records from Database in CodeIgniter - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/08\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png","datePublished":"2018-08-01T18:49:45+00:00","dateModified":"2018-08-01T18:51:29+00:00","description":"Delete multiple records in CodeIgniter - Example code to delete multiple rows using checkbox in CodeIgniter. Select \/ Deselect all checkboxes and get multiple checked checkbox value in CodeIgniter.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/08\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/08\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png","width":1366,"height":768,"caption":"delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/delete-multiple-records-from-database-in-codeigniter\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Delete Multiple Records from Database in CodeIgniter"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2018\/08\/delete-multiple-records-from-database-using-checkbox-in-codeigniter-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-SJ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=3393"}],"version-history":[{"count":3,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3393\/revisions"}],"predecessor-version":[{"id":3397,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/3393\/revisions\/3397"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/3396"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=3393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=3393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=3393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}