Let’s see other MySql commands in PHP.
1. mysql_num_rows():
It returns the number of rows resulting from mysql_query() output.
Example:
<?php $query = “select * from employees”; $result = mysql_query($query, $con); if(!$result) { die(‘Error getting table data’, mysql_error); } echo “Number of Employees in database – “.mysql_num_rows($result); ?>
2. mysql_result():
This function will return the resulted data of specified row. It returns the content of the entire cell.
Example:
<?php $query = “select name from employees where id=1”; $result = mysql_query($query, $con); if(!$result) { die(‘Error getting table data’, mysql_error); } return mysql_result($result); ?>