I use the tablename_after_insert func for sending an email to dedicated user when a new record is inserted. This works very well. I have embedded also a link in the email for the entered record:
Code: Select all
function ap_main_after_insert($data, $memberInfo, &$args){
$id = $data['id'];
$bezirk = $data['district_id'];
... //all other table fields
...
$messageData .= "Bezirk : $bezirk \n";
$messageData .= "Start VK Periode : $startvk \n";
... // all other email messages
$messageData .= "Link to record : http://intranet2/werbeplaner/ap_main_view.php?SelectedID=$id\n\n"; //allthough "SelectedID" is written with big capital it works!!!!!!! Otherwise not!!!
Now I want to do the same issue via after_update func when an existing record is changed/updated. So
I pasted the same code above (with some textual changes in messagedata) in the function tablename_after_update.
Unfortunatelly the result is not the same, i.g. the primary key id is not passed, so that for example the URL has not the record id at the end of the link http://.../SelectedID=123
I found in tablename_dml.php the section where the functions after_insert and after_update are called. There are differences due to the calls for the IDs: "$recID" and "$data['id']".
I tried to replace the $data['id']s in the section for after_update by the $recID like in the section for after_insert, but the result was the same as above (without passing the record id).
I hope I could explain my problem.
What could be the reason?
Many thanks in advance
Yilmaz