LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-06-2010, 05:29 AM   #1
ashok.g
Member
 
Registered: Dec 2009
Location: Hyderabad,India
Distribution: RHEl AS 4
Posts: 215

Rep: Reputation: 32
Delete Selected Rows in Perl/CGI


How can I delete selected rows of a table in perl/CGI??
 
Old 04-06-2010, 06:02 AM   #2
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
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? :-)
 
Old 04-06-2010, 06:17 AM   #3
ashok.g
Member
 
Registered: Dec 2009
Location: Hyderabad,India
Distribution: RHEl AS 4
Posts: 215

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by bakdong View Post
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.

Last edited by ashok.g; 04-06-2010 at 06:22 AM.
 
Old 04-06-2010, 06:57 AM   #4
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
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.
 
Old 04-06-2010, 07:15 AM   #5
ashok.g
Member
 
Registered: Dec 2009
Location: Hyderabad,India
Distribution: RHEl AS 4
Posts: 215

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by PMP View Post
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.
 
Old 04-06-2010, 10:30 AM   #6
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
Or use a hidden form field with the id value in it.
 
  


Reply

Tags
cgi, delete, records, selected


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with perl modules declaration and perl/cgi script shifter Programming 9 02-24-2010 09:09 AM
How to delete selected files? thomas2004ch Linux - Newbie 8 02-10-2010 11:50 AM
Parsing rows and column data from a file using perl dav_y2k Programming 1 10-08-2006 11:57 AM
cgi perl : I cant get perl to append my html file... the_y_man Programming 3 03-22-2004 05:07 AM
Perl Sqlite DBI $sth->rows The Jesus Programming 0 10-21-2003 11:35 PM


All times are GMT -5. The time now is 07:27 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration