I see that PDO does not support the fact that it always returns true if the first statement is independent of other requests. I still see that the error is for correction, because in my point of view coding will be easier and probably faster if we give what php for php and what for sql for mysql. I will give the following example here to see where it would be easier to code many requests together, if possible:
pdoQuery("INSERT INTO users SELECT * FROM temp_users WHERE user_id = ? LIMIT 0, 1; DELETE FROM temp_users WHERE user_id = ?; DELETE FROM sign_up_confirm_urls WHERE user_id = ?; INSERT INTO actions(user_id, code, foreign_id) VALUES (?, ?, ?);", Array($user_id, $user_id, $user_id, $user_id, $user_id, $actions_ini['create_account'], $user_id));
pdoQuery prepares the statement here, executes it and displays an error (if any for debugging will be disabled later). and when all requests succeed, he commits them. otherwise rollback
Well, to be true, this cannot be done. due to which each of these requests must be sent and checked individually with a lot of code.
or in this case
SET @id := NULL; SELECT id INTO @id FROM ? WHERE id = ? AND to_user = ?; INSERT INTO hidden_notifications(table_name, foreign_id) VALUES (?, NULL);
where the variable is required from the first request to the second. with php it needs to be requested with extraction, and then inserted back into the second line. I am not an expert in php or sql, maybe I'm the only one who thinks so. I just like to have a common function that I can rely on to do everything together so that I can pass on other problems. This may not be a very good way, but I came up with this job:
pdoQuery(array( array("INSERT INTO users SELECT * FROM temp_users WHERE user_id = ? LIMIT 0, 1;", array($user_id)), array("DELETE FROM temp_users WHERE user_id = ?;", array($user_id)), array("DELETE FROM sign_up_confirm_urls WHERE user_id = ?;", array($user_id)), array("INSERT INTO actions(user_id, code, foreign_id) VALUES (?, ?, ?);", array( $user_id, $actions_ini['create_account'], $user_id)) );
pdoQuery will send the transaction, then loop the skipped table and send each request .. if there is any failure, it will break and roll back. If everything goes well, he commits.
I look forward to suggesting how effective this is.