[eluser]John_Betong_002[/eluser]
Look at the error message
"there is no GROUP BY clause"
I think you should Google for something like
PHP MYSQL "GROUP BY" Tutorial and see if you can find where to insert the missing GROUP BY.
Best of luck
Code:
function select_top2($consti,$elect_year)
{
$qry =
“ SELECT candidate_votes,max(candidate_votes)
FROM candidate_details
WHERE candidate_votes < (Select max(candidate_votes)
FROM candidate_details)
AND elect_year = $elect_year And constituency_id = $consti”;
$result_category = $this->db->query($qry);
echo $this->db->last_query();
return $result_category->row();
}//