Page 1 of 1

update record

Posted: 2011-03-28 12:22
by mrhankey
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

Re: update record

Posted: 2011-03-31 14:44
by jguert
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".

Re: update record

Posted: 2011-04-13 10:04
by mrhankey
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

Re: update record

Posted: 2011-04-18 12:37
by Fred
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

Re: update record

Posted: 2011-04-21 11:47
by mrhankey
thanks fred for your help mate

Re: update record

Posted: 2011-04-28 10:39
by Fred
;)

Re: update record

Posted: 2011-05-09 20:40
by mrhankey
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

Re: update record

Posted: 2011-05-10 08:38
by Fred
As the last parameter of the form action.

Re: update record

Posted: 2011-05-25 12:06
by mrhankey
thanks fred