LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Delete Selected Rows in Perl/CGI (http://www.linuxquestions.org/questions/programming-9/delete-selected-rows-in-perl-cgi-800305/)

ashok.g 04-06-2010 05:29 AM

Delete Selected Rows in Perl/CGI
 
How can I delete selected rows of a table in perl/CGI??

bakdong 04-06-2010 06:02 AM

You haven't given much info. What table in what database? SQL? "delete from database.table;" http://www.t-scripts.com/perl/

Or something completely different? :-)

ashok.g 04-06-2010 06:17 AM

Quote:

Originally Posted by bakdong (Post 3926007)
You haven't given much info. What table in what database? SQL? "delete from database.table;" http://www.t-scripts.com/perl/

Or something completely different? :-)

I'm using MYSQL.
Ok I will explain my design here.
When a user login to the page, he is shown with all the data in an HTML table.
The user is provided with checkboxes where he can select all or certain records to delete. Based on the selected records, the data should be deleted from the actual database when the user clicks the delete button.

I know all the syntax and how to perform deletion of records in MYSQL.
But, the only thing is what should i give in the WHERE part of my SQL statement?
something like
Code:

DELETE FROM EMPLOYEE WHERE ID=?;
How can I get this ? from a HTML table?

Regards,
Ashok.

PMP 04-06-2010 06:57 AM

What is the value of your check box?

I would suggest you to set the value of this checkbox to the value of ID so that you can figure out which checkboxes are selected after the submission of the form.

ashok.g 04-06-2010 07:15 AM

Quote:

Originally Posted by PMP (Post 3926066)
What is the value of your check box?

I would suggest you to set the value of this checkbox to the value of ID so that you can figure out which checkboxes are selected after the submission of the form.

K i will do that and get back to you.
Thanks.

bakdong 04-06-2010 10:30 AM

Or use a hidden form field with the id value in it.


All times are GMT -5. The time now is 12:15 PM.