SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Member Shah Hussain's Avatar
    Join Date
    Jul 2007
    Location
    Pakistan
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face How to Delete Multiple Data Using Drop Down Menu

    Hello Guys,

    I have a big problem, can any body tell me how to delete multiple data from database using Drop Down Menu... i have try my best but failed, So please if any body know then please help.....

    bye
    Fstutorials.com - The best way to learn photoshop online

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you mean? I think you must be more clear about your problem.

    You have listed some categories in a your drop down and when you select one category and submit it, the all the records of that category in a table are to be deleted.

    Did i understand your problem?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    Made with a Mac! philm's Avatar
    Join Date
    Sep 2001
    Location
    Portsmouth, UK
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    rajug, he means a select list where you can choose multiple items.

    Shah, what is the value you are getting from your form after submitting multiple items in the list?

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by philm View Post
    rajug, he means a select list where you can choose multiple items.
    ... using Drop Down Menu ...
    I thought that when it is drop down menu then there should only be one selection from drop down, am i right?

    If it is meant that multiple selection then treate the multiple selection box as an array and get the values and delete respectively.
    PHP Code:
    $selectedids $_POST['multipleselectionlist'];
    for(
    $i 0$i count($selectedids); $i++){
        
    $sql "delete from tablename where id=" $selectedids[$i];
        
    mysql_query($sql) or die(mysql_error());

    Does this make sense now?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  5. #5
    Made with a Mac! philm's Avatar
    Join Date
    Sep 2001
    Location
    Portsmouth, UK
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rajug View Post
    I thought that when it is drop down menu then there should only be one selection from drop down, am i right?
    Normally yes because we're used to seeing the <select> with a size of one and everyone calls it a dropdown. Just a terminology issue really...

  6. #6
    SitePoint Member Shah Hussain's Avatar
    Join Date
    Jul 2007
    Location
    Pakistan
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I mean.... that how to delete multiple data from database... example :

    I am a website admin.. there user post comments 20+ a day... so some i am approving and some i am deleting... so how to do that.....

    look at the below image example :


    so how i can do some thing like that.. i want to approve some and want to delete some of them.....
    Fstutorials.com - The best way to learn photoshop online

  7. #7
    Made with a Mac! philm's Avatar
    Join Date
    Sep 2001
    Location
    Portsmouth, UK
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    /sigh

    You're initial post was very misleading

  8. #8
    SitePoint Member Shah Hussain's Avatar
    Join Date
    Jul 2007
    Location
    Pakistan
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, sorry for that big mistake..... but please can you help me... please
    Fstutorials.com - The best way to learn photoshop online

  9. #9
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is very simple if you use the radio buttons to Approve and Delete. When you list the comments, let the user to select one option and accordinly you can get them in action upon submitted.

    Also you can manage it with check boxes too if you well know about it. I don't think that you need the code to do so. You know further.

    Cheers!!
    Good Luck!
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  10. #10
    SitePoint Member Shah Hussain's Avatar
    Join Date
    Jul 2007
    Location
    Pakistan
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know how to do it with checkbox and radio button...... but don't know how to do it using Drop Menu....

    Please rajug, if you can do that, then please help me?
    Fstutorials.com - The best way to learn photoshop online

  11. #11
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the problem doing with checkbox or radio buttons? I think if you can do with check boxes then in the same way you can achieve it too with creating the select boxes array and with also one corresponding hidden array field to store IDs.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  12. #12
    SitePoint Member Shah Hussain's Avatar
    Join Date
    Jul 2007
    Location
    Pakistan
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, man thanks for your replies....
    Fstutorials.com - The best way to learn photoshop online


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
  •