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
Tell me how can we define a variable accessible in functions of a php script?
What is the difference between php 5 and php 7?
How can you create a session in php?
Explain the difference between require() and require_once()?
What are the differences between GET and POST methods?
What are the advantages of oops in php?
What is a php tag?
Explain the difference between array_merge() and array_combine()?
What does $_env means?
What is the difference between indexed and associative array?
What is the maximum size of a table in mysql?
What is preg_match?
What is null value in php?
What is a namespace in php?
What are the differences between php constants and variables?