I am facing problem with my php code. I have already tried Stack Overflow suggestions, but that code doesn't properly work. Here I am using max
and min
functions. Also trying function mysql_fetch_rows()
and mysql_fetch_assoc()
. It shows me the error undefined index:facilities_total in line...
I also point out my error in below code. Please suggest how to correct this.
This is my php with mysql query
$sqlMax= "SELECT projects_detail.Project_name,max(facility_rating.facilities_total)
AS MAX_FACILITIES_TOTAL
FROM facility_rating LEFT OUTER JOIN projects_detail
on facility_rating.project_id = projects_detail.project_id
group by facility_rating.facilities_total DESC LIMIT 1";
$resultMax=mysql_query($sqlMax);
echo "<table border cellpadding=3>";
while($rowsMax=mysql_fetch_array($resultMax)){
echo "<tr>";
echo "<td>".$rowsMax['Project_name'] . "</td> ";
echo "<td>".$rowsMax['facilities_total'] . "</td> "; //error undefined index:facilities_total
echo "</tr>";
}
echo "</table>";