Php Code To Get Number Of Rows In Mysqli Result Using Mysql Database
In this Php Tutorial we will see How To Use mysqli_num_rows To Get Number Of Rows From Mysqli Result Using MySQL Database Table In With Php .
I Use In This Tutorial:
- NetBeans IDE .
- XAMPP .
- PhpMyAdmin .
Php Source Code:
<?php
// PHP Using mysqli_num_rows Function
// get number of data in mysqli result
$host = "localhost";
$user = "root";
$pass = "";
$database = "test_db";
$connect = mysqli_connect($host, $user, $pass, $database);
$query = "SELECT * FROM users";
$result = mysqli_query($connect, $query);
$numRow = mysqli_num_rows($result);
echo "<h1>".$numRow."</h1>";
///////////////OUTPUT: 16