×

Please Login or Register to continue.

2
(957 Views)

(9.4K Points)
in PHP

Share

3 Answers
(9.4K Points)
2

The total number of rows count using PHP and MySQL .you can count using two methods. First of all, you can use the count() function. You have to need to define the count() function under the MySQL query.

$sql="select count('1') from users";

  We have used = count(1) function also we can use count(*) replace count(1) because. COUNT(*) counts the number of rows. Since both 0 and 1 are non-null values, COUNT(0)=COUNT(1) and they both will be equivalent to the number of rows COUNT(*). That is a different concept, but the result produce will be the same

 

The second method - 

In the second method, you count the MySQL table rows using 

mysqli_num_rows();

mysqli_num_rows(); function helps you count the MySQL table rows . 


TOTAL NUMBER OF ROWS COUNT USING PHP AND MYSQL


Comment

(7.3K Points)
(edited)
1
Count mysql table rows using count() function . Create a database table and insert some data into the database and use count() function that helps to count the rows of database table . You can echo the table rows number .

Comment
Thanks for sharing the valuable answer.
shakti 22 Oct 2018

(1.4K Points)
(edited)
1

Hope it will help. 

$sql="select count('*') from users";

Another. 

$mysqliStatus = $mysqli->query($sql);

$rows_count_value = mysqli_num_rows($mysqliStatus);

 echo $rows_count_value; 

 


Comment

Related Questions :-

Featured Items:-


Certificate and Marksheet system with verification & Franchise in PHP

$75



Certificate system in PHP website | PHP scripts

$22



Home Credito loan finance management multipurpose system in PHP

$65




Your Answer

You can post your answer after login..

Live Chat

Hello! How can we assist you today?