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 |
Explain about require and include function?
Explain which cryptographic extension provide generation and verification of digital signatures?
What is the purpose of the php empty function?
Is it more secure to use cookies to transfer session ids?
How to redirect a page in php?
Tell me what are sql injections, how do you prevent them and what are the best practices?
how to store case sensitive data in mysql ? how repair mysql table? diff bet float, double,real? diff bet mysql_fetch_object() and mysql_fetch_array()? which version of mysql support procedure , trigger? diff php4 and php 5? op - 2+5+"8"=? how to create object in javascript? query - select games from team who won games 2/4/6? NaN command in php? How to offload System date in mysql? typecasting in php? how to convert string to two decimal no? how to parse xml file in php command line argument in php? diff bet $msg,$$msg? diff bet require(), include(), include_once()? tables in mysql?
What is html used for?
What is file upload?
How the web server interprets php and interacts with the client?
What is sorting php?
What is isset php?