MySQL Forums
Forum List  »  Stored Procedures

Error 2014 & mysqli_fetch_assoc
Posted by: Alex Born
Date: December 06, 2020 10:27AM

Good day

I need a procedure like this

DROP PROCEDURE proc1;
DELIMITER //
CREATE PROCEDURE proc1()
BEGIN
START TRANSACTION;
SELECT id FROM table1 WHERE date<DATE_SUB(NOW(), INTERVAL 30 MINUTE);
DELETE FROM table1 WHERE date<DATE_SUB(NOW(), INTERVAL 30 MINUTE);
COMMIT;
END
//
DELIMITER ;

After calling this procedure in php i try to get result (id field) with function mysqli_fetch_assoc, but it gives error number 2014 (Commands out of sync; you can't run this command now).

If i put SELECT out of my procedure mysqli_fetch_assoc works fine, but i want SELECT inside transaction.

Any ideas?

Options: ReplyQuote


Subject
Views
Written By
Posted
Error 2014 & mysqli_fetch_assoc
801
December 06, 2020 10:27AM
354
December 06, 2020 12:00PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.