PDO and PHP/MySQL: what is the heck is wrong with PDO's prepared statements?
===

I know the title sounds ludicrous but I've done research for hours now to figure out that PDO ultimately buggy with no obvious solution...I am dedicated to being open for one.  I'm also willing to accept that my code is flawed.

Using PHP 5.2/Ubuntu, this code works (not using prepared statements/open to injection):

    $sql ="SELECT COUNT(*) FROM property p
    INNER JOIN property_attribute pa ON p.property_id = pa.property_id
    INNER JOIN property_area pc ON p.property_id = pc.property_id
    WHERE pa.attribute_value_id
        IN (
            SELECT av.attribute_value_id
            FROM attribute_value av
            INNER JOIN attribute a ON av.attribute_id = a.attribute_id
            WHERE a.name LIKE '$attributes'
            AND av.value LIKE '$values'
        ) 
    ORDER BY p.price ASC";
    $params = array();
    $rHowManyPages = Listings::HowManyPages($sql, $params);

However, using PDO's wonderful prepared statements:

    $sql ='SELECT COUNT(*) FROM property p
    INNER JOIN property_attribute pa ON p.property_id = pa.property_id
    INNER JOIN property_area pc ON p.property_id = pc.property_id
    WHERE pa.attribute_value_id
        IN (
            SELECT av.attribute_value_id
            FROM attribute_value av
            INNER JOIN attribute a ON av.attribute_id = a.attribute_id
            WHERE a.name LIKE :attributes
            AND av.value LIKE :values
        ) 
    ORDER BY p.price ASC';
    $params = array(':attributes' => $attributes, ':values' => $values);
    $rHowManyPages = Listings::HowManyPages($sql, $params);

It works, kinda.  Here's the Spartanic madness part: 1 in 5 refreshes of the same data being passed, PDO gives this error:

    TEXT: SQLSTATE[HY093]: Invalid parameter number

It's random!  How and why?