I'm trying to create a sort of update button, when a user clicks on a HTML Perl button it 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:
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, I'm looking for a Sub solution.
Thanks for your time and any help you can provide XD
EDIT: Project requirements only allow me to use perl, HTML and JavaScript.
DELETEafter theCREATEas you have created an empty table.DELETEis there because it only creates the table IF it is doesn't exist, otherwise it will use the existing table. If the values already exist, they need to be deleted. When I saySubI mean encased within a Perl Sub - that is of course if that is possible for what I want to do.