I have a field called 'Active' in my table compliance.
I would like to send an email only if the Active field is changed from TRUE to FALSE or from FALSE to true..
In PHP how do I code the 'if' condition properly?
I am most grateful for any help you can lend.
I have read all the php manuals I could find and most only show you how to compare.. I could compare old data with new data.. but not sure how to capture and compare old data in the hooks. As php does not allow more than one return per function from what I have read. I have tried making a global variable in the BEFORE UPDATE and BEFORE INSERT hooks on this table and dropping it into a log with no luck. Capturing the old data to compare it to the new data (no problem getting the new data) is the hard part. I cannot seem to get the old data before the update was done.
Any suggestions, Please post fast!
URGENT- How to send an email ONLY IF one field is changed?
URGENT- How to send an email ONLY IF one field is changed?
Tina O'Connell
Web Dev & Appgini FAN
Web Dev & Appgini FAN
Re: URGENT- How to send an email ONLY IF one field is change
How about adding a new field to your db called ActiveOld. Keep it hidden.
In after insert hook set ActiveOld = Active
In after update check if Active is equal to ActiveOld or not (so you get your answer) and then set ActiveOld = Active
Hope this helps.
In after insert hook set ActiveOld = Active
In after update check if Active is equal to ActiveOld or not (so you get your answer) and then set ActiveOld = Active
Hope this helps.
Re: URGENT- How to send an email ONLY IF one field is change
It sends the email whether the active field is the only one changed or not..
So.. nope.. not working.. I am going to PM you my full code.. and email. Thanks, Tina
So.. nope.. not working.. I am going to PM you my full code.. and email. Thanks, Tina
Tina O'Connell
Web Dev & Appgini FAN
Web Dev & Appgini FAN