Utilizing the MySQL Native Driver, you can use the MYSQLI_ASYNC
flag with the mysqli_query
function to make parallel, asynchronous MySQL DB calls.
I get how all that works, but what I'd really like to be able to do is somehow use the MYSQLI_ASYNC
flag with the prepared statement set of functions in PHP.
Is this possible, and if so, how?
It is not possible to use MYSQLI_ASYNC
with prepared statements.
The asynchronous functionality (mysqli_poll()
& mysqli_reap_async()
) was developed as kind of an experimental feature. It was never fully finished, and it's not super stable either. There have been suggestions to finally finish this feature, which some claim could be the only advantage over PDO, but there is not enough interest in this feature to finish it.
You would be much better off with a proper async solution that isn't mysqli specific. There are number of libraries available and the fibers PHP extension that can allow you to achieve this feature. After all, it's not really anything specific to MySQL or mysqli.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With