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 |
Describe PHP error and logging information?
Why use php artisan serve?
How to upload a file (may be a .txt or a .doc file) from a php script/file?
Can we override static method in php?
What is inheritance in php? How many types of inheritance supports php?
Write a program to upload a file in php?
How do you check if an arraylist is empty?
Define urlencode() and urldecode() used in php?
When is a conditional statement ended with endif?
How do you identify independent and dependent variables in regression analysis?
What are the special characters you need to escape in single-quoted stings?
Does php require a web server?