Try to change that line to this:
$sql3 = "select USERid from motm where votes ='" . $row_month['max(votes)'] . "'";
Anyway, $row_month['max(votes)'] looks kinda strange to me. 🙂
Ooppsss... same posting... I am late huh?! My internet connection is f***ing slow here... dial-up, u know... heheh...