The mysqli_num_rows() function is an inbuilt function in PHP which is used to return the number of rows present in the result set. It is generally used to check if data is present in the database or not. To use this function, it is mandatory to first set up the connection with the MySQL database.
mysqli_num_rows ( $result );
Parameters: This function accepts single parameter $result. It is a mandatory parameter and represents the result set returned by a fetch query in MySQL.
Return Value: It returns the number of rows present in a result set.
Consider there is a table named geek in a MySQL database named Geeks. Below is the description of the table geek.
Below programs illustrate the mysqli_num_rows() function in PHP.
Number of row in the table :5
- How to get the function name inside a function in PHP ?
- PHP | Ds\Set last() Function
- D3.js | d3.min() function
- PHP | Ds\Set add() Function
- D3.js | d3.hcl() Function
- p5.js | nf() Function
- CSS | rgb() Function
- p5.js | pan() Function
- p5.js | nfc() function
- p5.js | nfs() Function
- PHP | Ds\Map first() Function
- PHP Ds\Map sum() Function
- p5.js | nfp() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.