Error - mysqli_num_rows

Asked

Viewed 952 times

-1

Hello

I want to check the number of records in the bank and display on the screen the amount of records, but it’s not working, which may be wrong ?

   <?php

   include '../include/connection.php';

   $query = "SELECT id FROM user ORDER BY id ASC";

   $result = mysqli_query($link, $query) or die(mysql_error());

   $rows = mysqli_num_rows($result);

   while ($row = mysqli_fetch_array($result))
   {

      echo $rows;

   }
 ?>

Thank you

1 answer

0


In my view, to display the count of the records:

   include '../include/connection.php';
   $query = mysqli_query($link, "SELECT id FROM user ORDER BY id ASC") or print mysql_error();
   $rows = mysqli_num_rows($query);
   echo "Total de registros: ".$rows;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.