SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast iwiz_seo's Avatar
    Join Date
    Sep 2009
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to delete records from database using javascript's check all

    Could anybody tell me how to delete all the records selected using javascript check all function.

    Thank you all.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,398
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    Where? When?
    You can't access the database with javascript (the database is server side, JS is client side). If you want to use JS, you'll have to call a PHP script that'll do the deleting (take a look at AJAX).

  3. #3
    SitePoint Evangelist
    Join Date
    Aug 2009
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here you go -http://www.shiningstar.net/articles/articles/javascript/checkboxes.asp

    I have used this resource, it explains how to use JS to select/deselect all records. You just need to pass IDs of records (if you use checkboxes, IDs will be located inside array) and then use simple query like delete from xxx where id='zzz'
    Daniel, Helpdesk Leader
    Hosting24.com Web Hosting - First class web hosting services.
    Reseller Hosting - Provide unlimited disk space and bandwidth

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,597
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    JavaScript doesn't have a checkall function (unless you write one for it - and then it can do anything that JavaScript can do - including doing an Ajax call to a server side script that deletes your database if that's what you want it to do)
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •