top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the method to find the number of rows in a result set using PHP?

+1 vote
373 views
What is the method to find the number of rows in a result set using PHP?
posted May 19, 2014 by Rahul Mahajan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

With the help of function mysql_num_rows() ,you can find out the number of rows in result set.

For Example:
$result= mysql_query($sql,$db_link);
$rowcount=mysql_num_rows($result);
echo "$rowcount";

answer May 20, 2014 by Mohit Sharma
0 votes

how to fetch country ,state, and city, please recomdedd me

answer Feb 26, 2018 by Edward Anny Tyagi
Similar Questions
0 votes

I have a client where their next auto-increment number just jumped from 2300 to ********** for reasons not understood. They want it set back.

Options such as dropping the primary key and rebuilding the index is NOT possible -- this is a relational table thing. So, is there a way (programmatically) to set the next number in an auto-increment?

Something like:

alter table abc auto_increment = 2301;

Any ideas of why this happened?

+1 vote

which of the following is better to find the number of rows in a table?
1. count(1)
2. count(*)
3. count(rowid)

...