mysqli_stmt_fetch
stmt->fetch
Fetch results from a prepared statement into the bound variables
Description
Procedural style:
mixedmysqli_stmt_fetch
mysqli_stmtstmt
Object oriented style (method):
mysqli_stmt
mixedfetch
mysqli_stmt_fetch fetch the result from a prepared
statement into the variables bound by
mysqli_stmt_bind_result.
Note that all columns must be bound by the application before calling
mysqli_stmt_fetch.
&reftitle.returnvalues;
&reftitle.returnvalues;
Value
Description
&true;
Success. Data has been fetched
&false;
Error occured
&null;
No more rows/data exists
&reftitle.seealso;
mysqli_prepare,
mysqli_stmt_errno,
mysqli_stmt_error&listendand;
mysqli_stmt_bind_result.
&reftitle.examples;
Object oriented style
prepare($query)) {
/* execute statement */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($name, $code);
/* fetch values */
while ($stmt->fetch()) {
printf ("%s (%s)\n", $name, $code);
}
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
]]>
Procedural style
]]>
&example.outputs;