本文整理匯總了PHP中mysqli_stmt::next_result方法的典型用法代碼示例。如果您正苦於以下問題:PHP mysqli_stmt::next_result方法的具體用法?PHP mysqli_stmt::next_result怎麽用?PHP mysqli_stmt::next_result使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mysqli_stmt
的用法示例。
在下文中一共展示了mysqli_stmt::next_result方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fetchBindResult
/**
* Fetches the result from a prepared query.
*
* @param \MYSQLi_STMT $query The prepared query to fetch the result from.
*
* @return string[] The result array or null in case we have no result.
*
* @author Christian Achatz
* @version
* Version 0.1, 09.03.2010<br />
*/
private function fetchBindResult(\mysqli_stmt $query)
{
$result = null;
do {
$metaData = $query->result_metadata();
// in case the meta data is not present (e.g. for INSERT statements),
// we cannot fetch any data. thus we return null to indicate no result
if ($metaData === false) {
break;
}
$resultRow = [];
$resultParams = [];
while ($field = $metaData->fetch_field()) {
$resultParams[] =& $resultRow[$field->name];
}
$bindResult = [];
call_user_func_array([&$query, 'bind_result'], $resultParams);
while ($query->fetch()) {
$currentRow = [];
foreach ($resultRow as $key => $val) {
$currentRow[$key] = $val;
}
$bindResult[] = $currentRow;
}
$result[] = $bindResult;
} while ($query->more_results() && $query->next_result());
// for sprocs
return count($result) === 1 ? $result[0] : $result;
}