This topic is locked

New Action - Suggestion

7/27/2007 2:30:11 PM
PHPRunner General questions
G
gshafer author

The actions you provide are very useful and I see some new ones in V4.1
One thing I use them for is to send out an email when a new record is entered with all the field values.
I see you have added the ability to send out the field values (old or new) when a record is updated.
What would be really useful would be the ability to send out an email with only the fields that have changed and their old and new values.
Just a thought.....George

Sergey Kornilov admin 7/28/2007

George,
this very easy to implement:

function BeforeEdit(&$values, $where, &$oldvalues, &$keys)

{
$message = "Changed fields \n";
foreach ($values as $key => $value)

{

if ($value!=$oldvalues[$key])

$message .= $key . ": " . $value . "\n";

}
$email="test@test.com";

$subject="Sample subject";

mail($email, $subject, $message);

return true;
}