The input parameter $result_set is the output of result set identifier of mysqli_query(), mysqli_store_result() or mysqli_use_result().

The output is number of rows present in the result set.

MySQLI database connection file

Example : Object Oriented Style
require "config.php";// Database connection file.

$query="select * from student ";
if ($result_set = $connection->query($query)) {
echo "Total No. of records :".$result_set->num_rows;
Total No. of records :35


Procedural style
require "config.php";// Database connection file.

$query="select * from student ";
if ($result_set = mysqli_query($connection,$query)) {
echo "Total No. of records :".mysqli_num_rows($result_set);
Total No. of records :35
With bind_param & using variables
$query="select * from student WHERE class=? ";
$stmt->bind_param('s', $class); 
echo "Total No. of records :".$stmt->num_rows;

Checking if matching record is available

$t="SELECT * FROM istudent where mark >90";

// record found 	
// No record found 	

MySQL DUMP of student table

Post your comments , suggestion , error , requirements etc here

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 All rights reserved worldwide Privacy Policy Disclaimer