note 97773 added to mysqli.reap-async-query
| From: | eric dot caron at gmail dot com | Date: | Fri, 07 May 2010 06:05:02 +0000 |
| Subject: | note 97773 added to mysqli.reap-async-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169041@lists.php.net to get a copy of this message | ||
Keep in mind that mysqli::reap_async_query only returns mysqli_result on queries like SELECT. For
queries where you may be interested in things like affected_rows or insert_id, you can't work
off of the result of mysqli::reap_async_query as the example in mysqli::poll leads you to believe.
For INSERT/UPDATE/DELETE queries, the data corresponding to the query can be accessed through the
associated key to the first array in the mysqli::poll function.
So instead of
<?php
foreach ($links as $link) {
if ($result = $link->reap_async_query()) {
print_r($result->fetch_row());
mysqli_free_result($result);
$processed++;
}
}
?>
The data is accessible via:
<?php
foreach ($links as $link) {
if ($result = $link->reap_async_query()) {
//This works for SELECT
if(is_object($result)){
print_r($result->fetch_row());
mysqli_free_result($result);
}
//This works for INSERT/UPDATE/DELETE
else {
print_r($link);
}
$processed++;
}
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 209.23.129.248
----
Manual Page -- http://www.php.net/manual/en/mysqli.reap-async-query.php
Edit -- https://master.php.net/note/edit/97773
Del: integrated -- https://master.php.net/note/delete/97773/integrated
Del: useless -- https://master.php.net/note/delete/97773/useless
Del: bad code -- https://master.php.net/note/delete/97773/bad+code
Del: spam -- https://master.php.net/note/delete/97773/spam
Del: non-english -- https://master.php.net/note/delete/97773/non-english
Del: in docs -- https://master.php.net/note/delete/97773/in+docs
Del: other reasons-- https://master.php.net/note/delete/97773
Reject -- https://master.php.net/note/reject/97773
Search -- https://master.php.net/manage/user-notes.php