How can I calculate the average of column values in a mySQL table and display it in an HTML table?
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
$sql = 'SELECT AVG(price) FROM emp';
$retval = mysql_query( $sql, $conn );
$values = mysql_num_rows($retval);
echo $values;
It returns 1. I feel like the problem is with mysql_num_rows() but what will be the correct code to display the average output?