mysqli_stmt_num_rows
stmt->num_rows
Return the number of rows in statements result set
Description
Procedural style :
mixedmysqli_stmt_num_rows
mysqli_stmtstmt
Object oriented style (property):
mysqli_stmt
intnum_rows
Returns the number of rows in the result set.
The use of mysqli_stmt_num_rows
depends on whether or not you used
mysqli_stmt_store_result to buffer the entire result
set in the statement handle.
If you use mysqli_stmt_store_result,
mysqli_stmt_num_rows may be called immediately.
&reftitle.returnvalues;
An integer representing the number of rows in result set.
&reftitle.seealso;
mysqli_stmt_affected_rows,
mysqli_prepare&listendand;
mysqli_stmt_store_result.
&reftitle.examples;
Object oriented style
prepare($query)) {
/* execute query */
$stmt->execute();
/* store result */
$stmt->store_result();
printf("Number of rows: %d.\n", $stmt->num_rows);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
]]>
Procedural style
]]>
&example.outputs;