Hello, I want to run a MySQL UPDATE statement by pressing a Button in nuBuilder and using Hash Cookies to modify the statement. What is the most simple way to achieve this?
Best Regards
marcus
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
UPDATE statement by pressing a button
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: UPDATE statement by pressing a button
Hi Marcus,
Add an onclick event to your button with a code like
Next, create a (PHP) Procedure with a code like:
Add an onclick event to your button with a code like
Code: Select all
nuSetProperty('Your_Hash_Cooke','your string here');
nuRunPHPHidden('Your_Procedure_Name', 0);
Next, create a (PHP) Procedure with a code like:
Code: Select all
$hashCookie = "#Your_Hash_Cooke#";
nuRunQuery("UPDATE ...");
-
- Posts: 20
- Joined: Mon Nov 29, 2021 10:16 am
Re: UPDATE statement by pressing a button
Hello kev1n,
thanks for your reply, it works perfectly!
How can I pass on multiple hash cookies to the query?
thanks for your reply, it works perfectly!
How can I pass on multiple hash cookies to the query?
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: UPDATE statement by pressing a button
Either by setting each Hash Cookie with nuSetProperty(), using a different hash cookie name
... or by using nuRunPHPHiddenWithParams()
Example:
And in the PHP code, retrieve the parameters:
Code: Select all
nuSetProperty('Your_Hash_Cookie_1','your string here');
nuSetProperty('Your_Hash_Cookie_2','your other string here');
Example:
Code: Select all
nuRunPHPHiddenWithParams('your_procedure_name_here', 'param', {param1: 'value1', param2: 'value2'}, 0);
And in the PHP code, retrieve the parameters:
Code: Select all
$param = json_decode(base64_decode('#param#'));
$param1 = $param->param1;
$param2 = $param->param2;
-
- Posts: 20
- Joined: Mon Nov 29, 2021 10:16 am
Re: UPDATE statement by pressing a button
Hello kev1n, thank you very much! It works again perfectly!