What is mysql num rows in PHP

In this article I am going to explain about mysql_num_rows function in PHP.
  • 1831

PHP mysql_num_rows() Function

The PHP mysql_num_rows function is used to returns num of row in a result.

Syntax of mysql_num_rows function

mysql_num_rows(data)

Parameters in mysql_num_rows function

It has only one parameter:

Parameter Description
data It specifies data pointer to use.

Example of mysql_num_rows function

<?php

$con=mysql_connect("localhost","gupta","sharad");

if(!$con)

{

die("Could not connect:".mysql_error());

}

mysql_select_db("Mcn_Solution",$con);

$res=mysql_query("select * from Emp");

echo "Total no of rows = ".mysql_num_rows($res);

mysql_close($con);

?>


Output:

mysql-num-rows-php.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.