本文整理汇总了PHP中mysqli_stmt_prepare函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_stmt_prepare函数的具体用法?PHP mysqli_stmt_prepare怎么用?PHP mysqli_stmt_prepare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_stmt_prepare函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printf
<?php
$test_table_name = 'test_mysqli_stmt_send_long_data_packet_size_libmysql_table_1';
require 'table.inc';
if (!($stmt = mysqli_stmt_init($link))) {
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_mysqli_stmt_send_long_data_packet_size_libmysql_table_1")) {
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!mysqli_query($link, sprintf("CREATE TABLE test_mysqli_stmt_send_long_data_packet_size_libmysql_table_1(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine))) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!mysqli_stmt_prepare($stmt, "INSERT INTO test_mysqli_stmt_send_long_data_packet_size_libmysql_table_1(id, label) VALUES (?, ?)")) {
printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
$id = null;
$label = null;
if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label)) {
printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
if (!($res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))) {
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!($row = mysqli_fetch_assoc($res))) {
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
mysqli_free_result($res);
if (0 === ($max_allowed_packet = (int) $row['Value'])) {
printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
}
示例2: printf
printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
printf("[019] Expecting object/mysqli_result got %s/%s, [%d] %s\n", gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
$id = $label = null;
if (!mysqli_stmt_bind_result($stmt, $id, $label)) {
printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
$row = mysqli_fetch_assoc($res);
if (NULL !== $id || NULL !== $label) {
printf("[021] Bound variables should not have been set\n");
}
mysqli_free_result($res);
mysqli_stmt_close($stmt);
if (!($stmt = mysqli_stmt_init($link)) || !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") || !mysqli_stmt_execute($stmt)) {
printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
printf("[023] Expecting object/mysqli_result got %s/%s, [%d] %s\n", gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
if (!in_array($res->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))) {
printf("[024] Unknown result set type %s\n", $res->type);
}
if ($res->type !== MYSQLI_STORE_RESULT) {
printf("[025] Expecting int/%d got %s/%s", MYSQLI_STORE_RESULT, gettype($res->type), $res->type);
}
mysqli_free_result($res);
mysqli_stmt_close($stmt);
mysqli_close($link);
if (NULL !== ($res = mysqli_stmt_get_result($stmt))) {
示例3: safeinsert
public function safeinsert($table, $dataArray)
{
$field = "";
$safeparam = "";
$params = "";
$paramarr = [];
if (!is_array($dataArray) || count($dataArray) <= 0) {
$this->halt('没有要插入的数据');
return false;
}
$paramsnum = 0;
while (list($key, $val) = each($dataArray)) {
$nowtype = is_string($val) ? 's' : 'i';
$paramarr[] = $val;
$field .= "{$key},";
$safeparam .= "?,";
$paramsnum++;
$params .= $nowtype;
//之过滤字符串,int字形不用过滤
}
$field = substr($field, 0, -1);
$safeparam = substr($safeparam, 0, -1);
$sql = "insert into {$table}({$field}) values({$safeparam})";
$stmt = mysqli_stmt_init($this->link);
mysqli_stmt_prepare($stmt, $sql);
array_unshift($paramarr, $stmt, $params);
//把资源句柄和字符类型插入数组前两位
//参数要传引用。具体见PHP手册mysqli_stmt_bind_param
$parmlist = array();
foreach ($paramarr as $key => $value) {
$parmlist[$key] =& $paramarr[$key];
}
call_user_func_array("mysqli_stmt_bind_param", $parmlist);
$result = mysqli_stmt_execute($stmt);
$this->write_log("安全插入");
if (!$result) {
return false;
}
return true;
}
示例4: update_vote
function update_vote($image_id)
{
//get number of votes and update
global $link;
/*$result = mysqli_query($link, "SELECT `amount` FROM `votes_amount` WHERE `imageID`=".$image_id.";") or die(mysqli_error($link));
$amount = mysqli_fetch_assoc($result);
$new_amount = $amount['amount']+1;
mysqli_query($link, "UPDATE `votes_amount` SET `amount`=".$new_amount." WHERE `imageID`=".$image_id.";") or die(mysqli_error($link));*/
$stmt = mysqli_stmt_init($link);
mysqli_stmt_prepare($stmt, "SELECT `amount` FROM `votes_amount` WHERE `imageID`=?;") or die(mysqli_error($link));
mysqli_stmt_bind_param($stmt, 'i', $image_id);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
mysqli_stmt_close($stmt);
$amount = mysqli_fetch_assoc($result);
$new_amount = $amount['amount'] + 1;
$stmt = mysqli_prepare($link, "UPDATE `votes_amount` SET `amount`=" . $new_amount . " WHERE `imageID`=?;") or die(mysqli_error($link));
mysqli_stmt_bind_param($stmt, 'i', $image_id);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
//return ajax data
if (isset($_SESSION['id']) && !isset($_POST['action']) && !isset($_POST['votePic'])) {
$data = array('new_amount' => $new_amount, 'imageID' => $image_id);
} elseif (isset($_POST['action']) && $_POST['action'] == 'anonymous_voting') {
//get another two images
$result = mysqli_query($link, "SELECT * FROM `image` ORDER BY RAND() LIMIT 2;") or die(mysqli_error($link));
$data = array();
while ($row = mysqli_fetch_assoc($result)) {
$data[] = $row;
}
}
mysqli_close($link);
return $data;
}
示例5: insertItems
public function insertItems(Items $items)
{
$con = self::openConnection();
$affected = 0;
mysqli_begin_transaction($con);
$stm = mysqli_stmt_init($con);
$sql = "INSERT INTO category VALUES (?, ?, ?)";
mysqli_stmt_prepare($stm, $sql);
foreach ($items->getItems() as $item) {
$code = $item->getCode();
$name = $item->getName();
$parent = $item->getParent() == null ? null : $item->getParent()->getCode();
mysqli_stmt_bind_param($stm, 'sss', $code, $name, $parent);
mysqli_stmt_execute($stm);
if (mysqli_affected_rows($con) == 1) {
$affected++;
}
}
if ($affected > 0) {
mysqli_commit($con);
} else {
mysqli_rollback($con);
}
return $affected;
}
示例6: insertItems
public function insertItems(Items $items)
{
$con = self::openConnection();
$affected = 0;
mysqli_begin_transaction($con);
$stm = mysqli_stmt_init($con);
$sql = "INSERT INTO product VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
mysqli_stmt_prepare($stm, $sql);
foreach ($items->getItems() as $item) {
$code = $item->getCode();
$articul = $item->getArticul();
$name = $item->getName();
$bmuID = $item->getBasicMeasurementUnit() == null ? null : $item->getBasicMeasurementUnit()->getId();
$price = $item->getPrice();
$curID = $item->getCurrency() == null ? null : $item->getCurrency()->getId();
$muID = $item->getMeasurementUnit() == null ? null : $item->getMeasurementUnit()->getId();
$parent = $item->getParent() == null ? null : $item->getParent()->getCode();
mysqli_stmt_bind_param($stm, 'sssdddds', $code, $articul, $name, $bmuID, $price, $curID, $muID, $parent);
mysqli_stmt_execute($stm);
if (mysqli_affected_rows($con) == 1) {
$affected++;
}
}
if ($affected > 0) {
mysqli_commit($con);
} else {
mysqli_rollback($con);
}
return $affected;
}
示例7: bind_twice
function bind_twice($link, $engine, $sql_type1, $sql_type2, $bind_type1, $bind_type2, $bind_value1, $bind_value2, $offset)
{
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_mysqli_stmt_bind_param_type_juggling_table_1")) {
printf("[%03d + 1] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
return false;
}
mysqli_autocommit($link, true);
$sql = sprintf("CREATE TABLE test_mysqli_stmt_bind_param_type_juggling_table_1(col1 %s, col2 %s) ENGINE=%s", $sql_type1, $sql_type2, $engine);
if (!mysqli_query($link, $sql)) {
printf("[%03d + 2] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
return false;
}
if (!($stmt = mysqli_stmt_init($link))) {
printf("[%03d + 3] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
return false;
}
if (!mysqli_stmt_prepare($stmt, "INSERT INTO test_mysqli_stmt_bind_param_type_juggling_table_1(col1, col2) VALUES (?, ?)")) {
printf("[%03d + 4] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value1)) {
printf("[%03d + 5] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_execute($stmt)) {
printf("[%03d + 6] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value2)) {
printf("[%03d + 7] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_execute($stmt)) {
printf("[%03d + 8] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
mysqli_stmt_close($stmt);
if (!($res = mysqli_query($link, "SELECT col1, col2 FROM test_mysqli_stmt_bind_param_type_juggling_table_1"))) {
printf("[%03d + 9] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
return false;
}
if (2 !== ($tmp = mysqli_num_rows($res))) {
printf("[%03d + 10] Expecting 2 rows, got %d rows [%d] %s\n", $offset, $tmp, mysqli_errno($link), mysqli_error($link));
}
$row = mysqli_fetch_assoc($res);
if ($row['col1'] != $bind_value1 || $row['col2'] != $bind_value1) {
printf("[%03d + 11] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n", $offset, $bind_value1, $bind_value1, $row['col1'], $row['col2'], mysqli_errno($link), mysqli_error($link));
return false;
}
$row = mysqli_fetch_assoc($res);
if ($row['col1'] != $bind_value1 || $row['col2'] != $bind_value2) {
printf("[%03d + 12] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n", $offset, $bind_value1, $bind_value2, $row['col1'], $row['col2'], mysqli_errno($link), mysqli_error($link));
return false;
}
mysqli_free_result($res);
return true;
}
示例8: mysqli_query_insert
function mysqli_query_insert($type, $len, $runs, $host, $user, $passwd, $db, $port, $socket)
{
$errors = $times = array();
foreach ($runs as $k => $run) {
$times['INSERT ' . $type . ' ' . $run . 'x = #rows overall'] = microtime(true);
do {
if (!($link = @mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
$errors[] = sprintf("INSERT %s %dx = #rows connect failure (original code = %s)", $type, $run, $flag_original_code ? 'yes' : 'no');
break 2;
}
if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
$errors[] = sprintf("INSERT %s %dx = #rows drop table failure (original code = %s): [%d] %s", $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
break 2;
}
if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, label %s)", $type))) {
$errors[] = sprintf("INSERT %s %dx = #rows create table failure (original code = %s): [%d] %s", $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
break 2;
}
$label = '';
for ($i = 0; $i < $len; $i++) {
$label .= chr(mt_rand(65, 90));
}
$start = microtime(true);
if (!($stmt = mysqli_stmt_init($link))) {
$error[] = sprintf("INSERT %s %dx = #rows mysqli_stmt_init() failed (original code = %s): [%d] %s", $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
break 2;
}
$ret = mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)");
$times['INSERT ' . $type . ' ' . $run . 'x = #rows stmt_init() + stmt_prepare()'] += microtime(true) - $start;
if (!$ret) {
$error[] = sprintf("INSERT %s %dx = #rows mysqli_stmt_init() failed (original code = %s): [%d] %s", $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
break 2;
}
$start = microtime(true);
$ret = mysqli_stmt_bind_param($stmt, 'is', $i, $label);
$times['INSERT ' . $type . ' ' . $run . 'x = #rows stmt_bind_param()'] += microtime(true) - $start;
if (!$ret) {
$error[] = sprintf("INSERT %s %dx = #rows mysqli_stmt_bind_param failed (original code = %s): [%d] %s", $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
break 2;
}
for ($i = 1; $i <= $run; $i++) {
$start = microtime(true);
$ret = mysqli_stmt_execute($stmt);
$times['INSERT ' . $type . ' ' . $run . 'x = #rows stmt_execute()'] += microtime(true) - $start;
if (!$ret) {
$errors[] = sprintf("INSERT %s %dx = #rows stmt_execute failure (original code = %s): [%d] %s", $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
break 3;
}
}
mysqli_stmt_close($stmt);
mysqli_close($link);
} while (false);
$times['INSERT ' . $type . ' ' . $run . 'x = #rows overall'] = microtime(true) - $times['INSERT ' . $type . ' ' . $run . 'x = #rows overall'];
}
return array($errors, $times);
}
示例9: func_test_mysqli_stmt_param_count_table_1_mysqli_stmt_param_count
function func_test_mysqli_stmt_param_count_table_1_mysqli_stmt_param_count($stmt, $query, $expected, $offset)
{
if (!mysqli_stmt_prepare($stmt, $query)) {
printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_error($stmt));
return false;
}
if ($expected !== ($tmp = mysqli_stmt_param_count($stmt))) {
printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3, gettype($expected), $expected, gettype($tmp), $tmp);
}
return true;
}
示例10: test_format
function test_format($link, $format, $from, $order_by, $expected, $offset)
{
if (!($stmt = mysqli_stmt_init($link))) {
printf("[%03d] Cannot create PS, [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
return false;
}
if ($order_by) {
$sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
} else {
$sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
}
if (!mysqli_stmt_prepare($stmt, $sql)) {
printf("[%03d] Cannot prepare PS, [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_execute($stmt)) {
printf("[%03d] Cannot execute PS, [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_store_result($stmt)) {
printf("[%03d] Cannot store result set, [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!is_array($expected)) {
$result = null;
if (!mysqli_stmt_bind_result($stmt, $result)) {
printf("[%03d] Cannot bind result, [%d] %s\n", $offset + 4, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_fetch($stmt)) {
printf("[%03d] Cannot fetch result,, [%d] %s\n", $offset + 5, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if ($result !== $expected) {
printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n", $offset + 6, gettype($expected), $expected, gettype($result), $result, $format, $sql);
}
} else {
$order_by_col = $result = null;
if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
printf("[%03d] Cannot bind result, [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
reset($expected);
while ((list($k, $v) = each($expected)) && mysqli_stmt_fetch($stmt)) {
if ($result !== $v) {
printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n", $offset + 8, $k, gettype($v), $v, gettype($result), $result, $order_by_col, $format, $sql);
}
}
}
mysqli_stmt_free_result($stmt);
mysqli_stmt_close($stmt);
return true;
}
示例11: deleteJob
/**
* This function removes record with id $_GET[ID'] from the table Jobs
*/
function deleteJob()
{
global $db_conn;
$redirectlocation = "index.php?action=jobs";
$stmt = mysqli_stmt_init($db_conn);
global $db_conn;
$sql = "DELETE FROM `jobs` WHERE `JobID` = ?";
if (!mysqli_stmt_prepare($stmt, $sql)) {
print "Failed to prepare statement\n";
} else {
mysqli_stmt_bind_param($stmt, "i", $_GET['id']);
mysqli_execute($stmt);
mysqli_stmt_close($stmt);
}
immediate_redirect_to($redirectlocation);
// return to jobs
}
示例12: saveOrder
function saveOrder($dt)
{
global $link, $basket;
$goods = myBasket();
$stmt = mysqli_stmt_init($link);
$sql = 'INSERT INTO orders(title, author, pubyear,price, quantity, orderid, datetime)
VALUES(?,?,?,?,?,?,?)';
if (mysqli_stmt_prepare($stmt, $sql)) {
return false;
}
foreach ($goods as $item) {
mysqli_stmt_bind_param($stmt, 'ssiiisi', $item['title'], $item['author'], $item['pubyear'], $item['price'], $item['quantity'], $basket['orderid'], $dt);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
setcookie('basket', "", time() - 3600);
return true;
}
}
示例13: db_query
function db_query($sql, $bind = null)
{
$db = get_var('db');
$query = false;
$stmt = mysqli_stmt_init($db);
$sql = trim($sql);
if (mysqli_stmt_prepare($stmt, $sql)) {
if (!empty($bind)) {
$types = '';
$values = array();
foreach ($bind as $key => &$value) {
$value = stripslashes($value);
if (is_numeric($value)) {
$float = floatval($value);
$types .= $float && intval($float) != $float ? 'd' : 'i';
} else {
$types .= 's';
}
$values[$key] =& $bind[$key];
}
$params = array_merge(array($stmt, $types), $bind);
call_user_func_array('mysqli_stmt_bind_param', $params);
}
if (mysqli_stmt_execute($stmt)) {
if (preg_match('/^(SELECT|SHOW)/i', $sql)) {
if (db_native_driver()) {
$query = mysqli_stmt_get_result($stmt);
mysqli_stmt_close($stmt);
} else {
return $stmt;
}
} else {
$query = TRUE;
mysqli_stmt_close($stmt);
}
} else {
trigger_error(mysqli_stmt_error($stmt), E_USER_WARNING);
}
} else {
trigger_error(mysqli_error($db), E_USER_WARNING);
}
return $query;
}
示例14: executeQuery
function executeQuery($conn, $sql, array $parameters = []){
/*For matching the data type for binding*/
$typesTable = [
'integer' => 'i',
'double' => 'd',
'string' => 's'
];
$type = '';
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)){
raiseIssue('failed to prepare statement');
return false;
}
/*This bit should only run if any parameters are provided*/
if (!empty($parameters)){
foreach ($parameters as $parameter){
/*Look up the type from the types table */
$type .= $typesTable[gettype($parameter)];
}
array_unshift($parameters, $stmt, $type);
/*bit hacky because of call_user_func_array, it will not like $parameters by itself so it needs to be "passed in by reference" but calltime pass by reference is deprecated*/
$preparedParams = [];
foreach ($parameters as $index => &$label){
$preparedParams[$index] = &$label;
}
call_user_func_array('mysqli_stmt_bind_param', $preparedParams);
}
mysqli_stmt_execute($stmt);
/*Generating the result set for use. This gives you the column names as keys on each row*/
$result = mysqli_stmt_get_result($stmt);
$resultSet = [];
if(!$result){ return $resultSet; /*skips the result fetching if no results obtained*/}
while ($row = mysqli_fetch_assoc($result)){
$resultSet[] = $row;
}
mysqli_stmt_close($stmt);
return $resultSet;
}
示例15: func_test_mysqli_stmt_num_rows
function func_test_mysqli_stmt_num_rows($stmt, $query, $expected, $offset)
{
if (!mysqli_stmt_prepare($stmt, $query)) {
printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_execute($stmt)) {
printf("[%03d] [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_store_result($stmt)) {
printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if ($expected !== ($tmp = mysqli_stmt_num_rows($stmt))) {
printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3, gettype($expected), $expected, gettype($tmp), $tmp);
}
mysqli_stmt_free_result($stmt);
return true;
}