This topic is locked
[SOLVED]

fieldname list required

9/2/2022 6:33:50 AM
PHPRunner General questions
K
kohle author

Hi,

I want to write a function which I can use in the AfterUpdate event for different tables.

One way is :

$fieldnames = array("name", "email", "age" ,"gender" );
foreach ($fieldnames as $field) {
if($values($field)!=$oldvalues($field)
{
//execute sql for insert into log table
}
}

The problem is I need to know the fieldnames and have to put them into an array first,
but for writing a global function this is not helpful.

I am looking for something like in javascript to receive the names :

$fieldnames = rowData.fields ; (retrieving the fieldnames in the Afterupdate event)

// and than I process them

foreach ($fieldnames as $field) {
if($values($field)!=$oldvalues($field)
{
//execute sql for insert into log table
}
}
K
kohle author 9/2/2022

Ok,
I works now with

$fieldnames = array_keys($values) ; (retrieving the fieldnames in the Afterupdate event)
G
gchable 9/2/2022
foreach ($values as $key => $value){
if ( $value != $oldvalues[$key] ){
// dsis...
}
}