Last index command messed up after Security module

I use the last index retrieve command often

sc_lookup(ps,“select last_insert_id()”);
[GPCIndex] = {ps[0][0]};

It has always done the job for me, but I recently turned on the security log which logs all transactions.

Right after I do my table update, it inserts a log entry, and that is the one that is retrieved.

Has anyone experienced this?

Ideally I would like to specify the table of the last index entry

L

Not 100% sure, but if you have the security log table in a dedicated db/connection, it shouldn’t interfere with the last_insert_id of all your other dbs/connections.
-EDIT-
Actually that’s true per client connection and I think that it will always be the same from the same web server your apps are running on to the same sql server it uses as backend.

So what is the solution?