PHP mysqli_num_rows() Function

Object oriented style

int $mysqli_result->num_rows;

Procedural style

int mysqli_num_rows ( mysqli_result $result )

Returns the number of rows in the result set.The behaviour of mysqli_num_rows() depends on whether buffered or unbuffered result sets are being used. For unbuffered result sets, mysqli_num_rows() will not return the correct number of rows until all the rows in the result have been retrieved.

Examples -

Object oriented style

Procedural style

The above examples will output:

Result set has 239 rows.

ParameterDescription
resultProcedural style only: A result set identifier returned by mysqli_query(), mysqli_store_result() or mysqli_use_result().

Returns number of rows in the result set.