Good time of the day, I have my own procedure, which should receive the oldest entry and update the date of access to this entry, when calling

mysql> CALL User ();

Query OK, 1 row affected (0.06 sec)

It will always return OK. I understand this because the result of the UPDATE function is returned. If you remove the UPDATE query, then the normal result is returned as it should be ...

Actually the question is how to leave UPDATE but what would the procedure return the result of the work select?

CREATE DEFINER=`h`@`%` PROCEDURE `User`() BEGIN SELECT userP.id, userP.username, INTO @id, @username, FROM `User` ORDER BY DateUse ASC limit 1; UPDATE `User` SET DateUse=CURRENT_TIMESTAMP WHERE id=@id; END 
  • What does your select do and why should it be returned? - Roman C
  • Um ... does a sample of the database, I just have to update the date of the last access to the record when sampling ... So I want to do this with protsidura - ff.0xff
  • Query OK returns NOT the procedure, but the query itself. All the output in the procedure goes to the output. How to leave UPDATE but what procedure would return result of operation of select? Two requests - two outputs. Two data sets if the call is not from the console. Accordingly, in the program you take the one you need - stupidly by its ordinal number. - Akina
  • I seem to understand what you are talking about - but what is strange is that I always get false in php when I deduce it - can you have a good example in php how can this be done? - ff.0xff

0