How can we find the number of rows in a result set using PHP?
Answer Posted / 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 |
Post New Answer View All Answers
How to create a public static method in PHP?
Which function would you use to insert a record into a database in php?
Is php dead 2019?
What is difference between mysql_connect and mysqli_connect?
How can we increase execution time of a php script?
What is difference between mysqli and mysql?
What is PECL?
What are the 3 types of sessions?
Define object-oriented methodology?
How will you calculate days between two dates in PHP?
Explain about looping in PHP?
What is a session in php?
What happens if an expected input field was not submitted?
What are escaping characters?
Which function is used to read a single character from a file in PHP.