zodiac_vn93
New Member
\[code\]$result = mysql_query("SELECT avg(r.rate) FROM rate r where ImgName='1'");\[/code\]this php is not working.Originally my code is\[code\]<?php$con = mysql_connect("localhost","root","sql");if (!$con){ die('Could not connect: ' . mysql_error());}mysql_select_db("photogallery", $con);$result = mysql_query("SELECT avg(r.rate) FROM rate r ");echo "<table border='0' cellspacing='5'>";echo "<th> Average Rating </td>";while($row = mysql_fetch_array($result)){ echo "<tr>"; echo "<td> " . $row['rate'] . "</td>"; echo "</tr>";}echo "</table>";mysql_close($con);?> \[/code\]the above is not showing any out put.but modify code i.e. then its workin.$result = mysql_query("SELECT r.rate FROM rate r ");but i want to aggregate function thanks in advance