PHP asynchronous mysql-query -


my app first queries 2 large sets of data, work on first set of data, , "uses" on second.

if possible i'd instead query first set synchronously , second asynchronously, work on first set , wait query of second set finish if hasn't , use first set of data on it.

is possible somehow?

it's possible.

$mysqli->query($long_running_sql, mysqli_async);  echo 'run other stuff';  $result = $mysqli->reap_async_query(); //gives result (and blocks script if query not done) $resultarray = $result->fetch_assoc(); 

or can use mysqli_poll if don't want have blocking call

http://php.net/manual/en/mysqli.poll.php


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -