using afterProcessing

i am try to use afterProcessing to insert a row in an second calendar-table.
How must i do this? I will use the insert_related($action) - function, which was defined for correct edit of recurr. events

[code]function insert_related($action){
$status = $action->get_status();
$type =$action->get_value(“rec_type”);

	if ($status == "inserted" && $type=="none"){
		INSERT INTO 'cal_second' ( 'event_text', 'start_date', 'end_date', 'user_id') VALUES ('test_room','2011-03-04 19:00:00','2011-03-04 19:15:00',1 );

But it’s display a clear Alert-Box and now row is inserted.

Check … foreupdate