Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use something like this in your HTML check all page</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;Select/Delete ALL with jQuery/PHP&lt;/title&gt; &lt;script src="http://code.jquery.com/jquery-1.10.1.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;table border="1" cellpadding="5"&gt; &lt;tr&gt; &lt;th&gt; &lt;input type="checkbox" id="checkAll" /&gt; &lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="checkbox" class="check" name="posts[]" value="100" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="checkbox" class="check" name="posts[]" value="200" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="checkbox" class="check" name="posts[]" value="300" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;script&gt; $(document).ready(function(){ var checked = false; $('#checkAll').click(function(){ if (checked == false){ checked = true } else { checked = false } $('input.check').attr("checked",checked); var confirmDelete=confirm("You checked all the box. Delete All?"); if (confirmDelete==true){ var csv = ''; $('.check').each(function() { csv += $(this).attr("value") + ","; }); $.ajax({ type: "POST", url: "delete.php", data: { tobeDeleted: csv } }).done(function( msg ) { console.log( "Data has been deleted: " + msg ); }); } else { $('#checkAll').attr("checked", false); $('input.check').attr("checked", false); } }); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and use something like this in your PHP script</p> <pre><code>&lt;?php $postDeleted = substr($_POST['tobeDeleted'], 0, strlen($_POST['tobeDeleted'])-1); $arrDeleted = explode(",", $postDeleted); $sql = "DELETE FROM employee WHERE 1=1 "; foreach($arrDeleted as $key=&gt;$value){ $sql .= "OR employee_id = $value "; } echo $sql; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload