ScottChapman
Založený: 09.06.2007
Príspevky: 31
Zaslal: 2009-04-20 23:31
Návrat hore
Odpovedať s citátom
|
So, I have turned on logging so that I get email when something changes.
The problem is that I am using an ID field for an index, and I hide the value since it is really only used to drive phpMyEdit.
So, when I get an email, it tells me the ID, which isn't very helpful.
Anyway I can get it to report some other fields (which will help me match the record) even if they don't change? Or perhaps some other mechanism for modifying the email content?
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-22 14:57
Návrat hore
Odpovedať s citátom
|
You would have to edit the function in the class file which sends the email. The $newvals array would probably be available (might have to declare it as global in the mail function).
Something like this would give you keys and values for all fields, and the append it to the email:
| Kód: |
| $print_r_text = preg_replace('/\n/s', "\r\n", print_r($newvals, true)); |
|
ScottChapman
Založený: 09.06.2007
Príspevky: 31
Zaslal: 2009-04-22 15:16
Návrat hore
Odpovedať s citátom
|
Thanks.
Would the newvals array contain all the values in the record regardless of what operation was performed?
Or does it only contain the changes values?
And does it contain values when a delete operation is done?
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-22 23:04
Návrat hore
Odpovedať s citátom
|
$newvals and $oldvals are available, most often with respect to triggers. These arrays are not compared. If MySQL detects they are identical then nothing is updated. Upon deletion, these may not exist. Use the change log table and look at what is populated there on different operations, just for the sake of comparison.
|
ScottChapman
Založený: 09.06.2007
Príspevky: 31
Zaslal: 2009-04-22 23:07
Návrat hore
Odpovedať s citátom
|
Yep. Got the changelog setup and that it working.
However it does stop the before and after as BLOBs, so I am not sure how useful that is to me...
Would be nice to be able to use that information...
|
ScottChapman
Založený: 09.06.2007
Príspevky: 31
Zaslal: 2009-04-24 00:11
Návrat hore
Odpovedať s citátom
|
sorry, I meant that it stores the before and after states as blobs. So, it is difficult to use the information in the changelog table...
Know what I mean?
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-04-24 02:33
Návrat hore
Odpovedať s citátom
|
Probably time to write your own trigger(s). Figure out what you want to see in the email, query that record number, and have it send you the data in whatever format you want it.
|
ScottChapman
Založený: 09.06.2007
Príspevky: 31
Zaslal: 2009-04-24 02:49
Návrat hore
Odpovedať s citátom
|
True, I can certainly do that!
|
|
Odoslať novú tému
Odpovedať na tému
|