update record

Any tips and tricks that has to with the ADDT that doesn't fit into one of the other categories
mrhankey
Posts: 45
Joined: 2010-07-31 18:20

update record

Post by mrhankey » 2011-03-28 12:22

hi,



i have an insert form generated by addt which works fine, however i have added an update transaction to this, to be triggered from the insert form submit button.



however it does not update the table:



this is the update code:



// Make an update transaction instance
$upd_clients = new tNG_update($conn_cbank);
$tNGs->addTransaction($upd_clients);
// Register triggers
$upd_clients->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
// Add columns
$upd_clients->setTable("clients");
$upd_clients->addColumn("Status", "STRING_TYPE", "VALUE", "Case");
$upd_clients->setPrimaryKey("ClientID", "NUMERIC_TYPE", "GET", "ClientID");



hope someone can help.



many thanks

jguert
Posts: 3
Joined: 2011-03-31 14:38

Re: update record

Post by jguert » 2011-03-31 14:44

Hi mrhankey,

try to change KT_Insert1 in KT_Update1.

$upd_clients->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1");

You also need an update-button in the form named "KT_Update1".

mrhankey
Posts: 45
Joined: 2010-07-31 18:20

Re: update record

Post by mrhankey » 2011-04-13 10:04

hi,

thanks for the reply.

sorry it is not an update record it is an insert record got mixed up when posting with what i was working on.

anyway the code i have tried is:

// Register triggers
$ins_cash_sale->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
$ins_cash_sale->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$ins_cash_sale->registerTrigger("END", "Trigger_Default_Redirect", 99, $_SERVER['HTTP_REFERER']);

i basically want it to redirect to the previous page the user was on?

thanks again

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: update record

Post by Fred » 2011-04-18 12:37

Add this at the top of your referring page and your update page

Code: Select all

// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');
Then call your update page like this

Code: Select all

/admin/transactions_edit.php?KT_back=1

mrhankey
Posts: 45
Joined: 2010-07-31 18:20

Re: update record

Post by mrhankey » 2011-04-21 11:47

thanks fred for your help mate

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: update record

Post by Fred » 2011-04-28 10:39

;)

mrhankey
Posts: 45
Joined: 2010-07-31 18:20

Re: update record

Post by mrhankey » 2011-05-09 20:40

hi fred thanks for all your help mate.

just a quick one, where would i add the call in the update record?

in the addt transaction code or in the form action?

thanks mate

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: update record

Post by Fred » 2011-05-10 08:38

As the last parameter of the form action.

mrhankey
Posts: 45
Joined: 2010-07-31 18:20

Re: update record

Post by mrhankey » 2011-05-25 12:06

thanks fred

Post Reply