i have checked over this code several times and just cant see where the error is.
function get_last_winner() {
$time = time();
$query = query("SELECT * FROM `tournaments` WHERE `judge_end` < '" . $time . "' ORDER BY `judge_end` DESC");
$tourney = mysql_fetch_array($query);
$query2 = query("SELECT * FROM `signature_entries` WHERE `tourney_id` = '" . $tourney['id'] . "'");
$entry_ratings = array();
while($row = mysql_fetch_array($query2)) {
$query3 = query("SELECT * FROM `votes` WHERE `voted_for` = '" . $row['id'] . "');
$count = mysql_num_rows($query3);
$ratings = array();
while($row2 = mysql_fetch_array($query3)) {
$row_rating = $row2['rating'];
$ratings[$row_rating];
}