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
What is mysql_fetch_object?
How is a session id generated?
Where is php code written?
Is null check in php?
What is string and its function?
How to remove values saved in the current session?
Code to upload a file in PHP?
What are the __construct() and __destruct() methods in a php class?
How to swap two variables without using 3rd temp variable.
Which will check if a function exists?
How can php and html interact?
Explain what does the unlink() function means?
How to get a total number of rows available in the table?
what the new feature add in php 7.2?
Why ide is recommended for use while programming with php?