Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,871
    Thanks
    2
    Thanked 164 Times in 159 Posts
    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?

  • #3
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,871
    Thanks
    2
    Thanked 164 Times in 159 Posts
    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.

  • #5
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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

  • #6
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,871
    Thanks
    2
    Thanked 164 Times in 159 Posts
    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.


  •  

    Tags for this Thread

    Posting Permissions

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