When we process a select query to get some records from SQL and we want to see how many rows are returned in the query we have a special function for this in php. mysql_num_rows(); using mysql_num_rows function we can get the number of records returned from MySQL query.
First we need a Query to select some records from database table, once we run query to get results we save that returned results into a variable and we process that variable in mysql_num_rows() function. This is how we can get number of rows mysql returned to our query.
$query = "SELECT * from users WHERE user_email=’".$email."’";
$query_result = mysql_query($query) or die(mysql_error());
$number_of_rows = mysql_num_rows($query_result);
Now we have number of rows in php variable $number_of_rows. To get number of rows we use mysql_num_rows.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?