On Update Event

QuestionsOn Update Event
Sebastián Esteller asked 5 years ago

Hello,
I have a function when update record of my grid. I explain, this function need connect with api of mailchimp if field record are update, if not are update no need this action.

My problem is as detect email variation, i need data of record after update and before update. Before update no problem, but I do not know how to get the record before updating.

Can you help me?
Thank, Sebastian.

1 Answers
Abu Ghufran answered 5 years ago

You can use both events:

$e["on_update"] = array("update_client", null, true);
OR
$e["on_after_update"] = array("update_client", null, true);

function update_client($data)
{
….
}

The $data will have new posted data. If you want to use old data, you will have to execute another sql query that will read table based on posted ID, and fetch data. This is valid for on_update only (before update event).

$data structure can be checked in demos/editing/custom-events.php code.

Your Answer

12 + 16 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!