Jump to content

char0n

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

char0n's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. well, i am not sure if i understood it correctly but here is my solution. I just guess u have 2 related tables and u want to sort values from one table according to the value from another SELECT t1.ID, t1.text FROM table1 AS t1 LEFT JOIN table2 AS t2 ON t1.ID=t2.ID WHERE t1.ID='1' ORDER BY t2.Rank ASC LIMIT 0, 30 Hope it little bit helped u
  2. Hello, 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: [CODE] 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 online_insert('{$_SERVER['REMOTE_ADDR']}')"); But I get error: query: call online_insert('84.47.19.168') error: Can't update table 'subs_online' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. I tried change "AFTER UPDATE" to something else, but nothing worked as expected. Could someone help me on this issue please ? Thanks a lot.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.