Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-07-2011, 12:32 PM   PM User | #1
schuhmi2
New to the CF scene

 
Join Date: Mar 2011
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
schuhmi2 is an unknown quantity at this point
Question update button with SQL problem

Hi all,

I've been attacking google for a while and not had much success

I'm trying to create a sort of update button, when when a user clicks on a HTML Perl button, asks for confirmation (yes/no). If the user clicks "Yes", it runs a SQL script, then returns a pop-up (JavaScript) saying operation successful (or not).

The SQL code is creating a backup table, then copying the current values stored in the database to this backup table, so no screen refresh is necessary. The complete and functioning code is provided below:

Code:
CREATE TABLE IF NOT EXISTS backup_tab_right_mapping
	LIKE tab_right_mapping;
DELETE FROM backup_tab_right_mapping
	WHERE group_id = "1"
	AND role_id = "1";
INSERT INTO backup_tab_right_mapping
SELECT * FROM tab_right_mapping
	WHERE group_id = "1"
	AND role_id = "1";
However I dont want to use PHP or CGI, I'm looking for a Sub solution.

Thanks for your time and any help you can provide XD
schuhmi2 is offline   Reply With Quote
Old 03-07-2011, 04:24 PM   PM User | #2
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,757
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
There is no such thing as an "HTML Perl button". I assume you mean that you have an html page which was generated by a Perl script and on that page you have a submit button.

If you don't want to use PHP or CGI (I assume you mean Perl), what server side language do you want to use?

What do you mean by "Sub solution"?

Do you understand how the communication works between a web server and your browser?
FishMonger is offline   Reply With Quote
Old 03-08-2011, 07:49 AM   PM User | #3
schuhmi2
New to the CF scene

 
Join Date: Mar 2011
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
schuhmi2 is an unknown quantity at this point
Probably not worded in the best way, I admit. I'm still getting used to the correct terminology - thanks for the correction

But it looks like you got what I mean.

When I say "Sub solution", what I mean is a Perl Sub

Just also realised I didnt want to say CGI there, thought I deleted it (whoops)

Last edited by schuhmi2; 03-08-2011 at 07:52 AM..
schuhmi2 is offline   Reply With Quote
Old 03-08-2011, 01:31 PM   PM User | #4
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,757
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
Do you still need help with this, or have you figured it out?

If you need help with the subroutine, then you'll need to provide more details. Have you written a sub and is it not doing what you want? Exactly what should it do? What is it not doing which it should be doing? What errors/warnings does it produce.
FishMonger is offline   Reply With Quote
Old 03-08-2011, 02:10 PM   PM User | #5
schuhmi2
New to the CF scene

 
Join Date: Mar 2011
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
schuhmi2 is an unknown quantity at this point
Help would be nice, please.

Well, I've got the rest of the website coded, its just this one button that is causing a problem.

The MySQL is above in the original point, thats all I have in regard to this problem. I just need a way in which I can execute the statement from a button on the website that are within the project requirements (only allowed to use perl, html, myself, and JavaScript).

Cheers
schuhmi2 is offline   Reply With Quote
Old 03-08-2011, 03:17 PM   PM User | #6
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,757
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
The normal process is to have a form on your page which has a submit button. The action attribute of the form points to a Perl script. The Perl script parses the form submission and executes your sub that handles the db stuff. Then the script will either output a new page do a redirect to another page.

What part of that process do you need help with? Note that I'm emphasizing the word help, not that I'm going to write your script for you.
FishMonger is offline   Reply With Quote
Reply

Bookmarks

Tags
button, html, mysql, perl, update

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:56 AM.


Advertisement
Log in to turn off these ads.