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
Comments
Post a Comment