Custom loop with multiple taxonomy queries

Here’s a function to do a query with multiple taxonomies:

function posts_search ($post_type,$taxonomies) { // $taxonomies should be an array ('taxonomy'=>'term', 'taxonomy2'=>'term2')
    foreach ($taxonomies as $key=>$value) {
        $args=array('post_type'=>$post_type,'post__in'=>$ids,$key=>$value);
        unset($ids); $ids=array();
        foreach($posts=get_posts($args) as $post) { $ids[]=$post->ID; }
        if (empty($ids)) return false;
    }
    return $posts;
}

And here’s an example on how i used it in a past project:

$posts = posts_search ('produtos',array('prod-categoria'=>'blocos','prod-cols'=>'7-c')); 
if($posts) { 
    foreach($posts as $post) { 
        // show infos from the post... 
    } 
}

The produtos is the custom post type upon which i’m doing the search, prod-categoria and prod-cols are two custom taxonomies and blocos and 7-c are two terms from the previous custom taxonomies.

Hope that helps.

OBS1; the function is not from me, but probably from an old post here.
OBS2; this was funcional on a 3.1.2 installation.

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