Placing the two most voted posts at the top (in a WordPress site that uses the Vote it up plugin)?

a while back i used that plugin and i needed a way to list most voted posts so after looking at the plugin’s widget code and i came up with this function:

function top_voted($number){
    $a = SortVotes();
    echo '<div class="voted">';
    $rows = 0;
    //Now does not include deleted posts
    $i = 0;
    while ($rows < $number)) {
        if ($a[0][$i][0] != '') {
                $postdat = get_post($a[0][$i][0]);
            if (!empty($postdat)) {
                $rows++;
                echo '<div class="fore">';
                echo '<div class="votecount" style="width: 1em; color: #555555; font-weight: bold;">'.$a[1][$i][0].' </div><div><a href="'.$postdat->guid.'" title="'.$postdat->post_title.'">'.$postdat->post_title.'</a></div>';
                echo '</div>';
            }
        }
        if ($i < count($a[0])) {
            $i++;
        } else {
            break; //exit the loop
        }
    }
    echo '</div>';
}

Usage:

top_voted(5);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)