Do you have a question? Post it now! No Registration Necessary. Now with pictures!
May 17, 2006, 9:40 am
rate this thread
I never worked with SP/triggers in MySQL, I have this problem. On
webpage I'd like to show online users, so idea is very simple: in one
select (SP) make all necesary things. I begin with:
CREATE TRIGGER online_insert
AFTER UPDATE ON subs_online
FOR EACH ROW
DELETE FROM subs_online WHERE ts < (unix_timestamp() - 180);
CREATE PROCEDURE online_insert(ip char(15))
INSERT INTO subs_online
(ip, ts) VALUES (ip, unix_timestamp())
ON DUPLICATE KEY UPDATE ts=unix_timestamp();
IN PHP: $this->db->DbQuery("call
But I get error:
query: call online_insert('22.214.171.124')
error: Can't update table 'subs_online' in stored function/trigger
because it is already used by statement which invoked this stored
I tried change "AFTER UPDATE" to something else, but nothing worked as
Could someone help me on this issue please ?
Thanks a lot.
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum