echo who has the max totalmark? $sqlquery2 = "SELECT fname, surname, max(exam + project + participation) AS totalmark FROM details";
$results2 = mysql_query($sqlquery2);
I can't store totalmark as an extra column in the database which would make it alot easier.