How can we find the number of rows in a result set using PHP?
Answers were Sorted based on User's Feedback
Answer / rajan vardawaj
Here is how can you find the number of rows in a result set
in PHP: $result = mysql_query($any_valid_sql,
$database_link); $num_rows = mysql_num_rows($result); echo
“$num_rows rows found”;
| Is This Answer Correct ? | 14 Yes | 0 No |
Answer / sunil kumar
<?php //first establish connection with database
mysql_connect("localhost","root","");
mysql_select_db("demoprj");
// then write the query suppose our table is tbl_student
$sql_stu="select* from tbl_student";
$res_stu=mysql_query($sql_stu);
$rows_stu=mysql_num_rows($res_stu);
echo"number of rows in tbl_student are=".$rows_stu;
?>
| Is This Answer Correct ? | 2 Yes | 0 No |
What is an associative array?
Are php short tags acceptable to use?
When you want to show some part of a text displayed on an html page in red font color? What different possibilities are there to do this? What are the advantages/disadvantages of these methods?
Do you know when sessions ends?
What are the limitations or drawbacks of PHP ?
In mail($param1, $param2, $param3, $param4), the $param2 contains__
What is singleton class in php?
Is numeric in php?
how many types of inheritance is there in php? name there?
Which framework is best for php?
What is the function of string in c?
What is asort php?