Query with multiple where clause I have a query that works fine with one where clause however when I add AND it doesn't work, can someone please tell me what I'm doing wrong?

$args2 = array(':name' =&gt; $existingproductIDfield);
$args3 = array(':vid' =&gt; '6');
    $result2 = db_query('SELECT * FROM taxonomy_term_data WHERE name = :name', $args2 .'AND vid = :vid', $args3);

    if ($result2-&gt;rowCount() &gt; 0) {
        foreach($result2 as $row) print_r($row);

    }
Parameter replacement is done all in one go, and you just need to provide a single associative array of args to db_query() for those replacements:

$args = array(':name' =&gt; $existingproductIDfield, ':vid' =&gt; 6);

$result2 = db_query('SELECT * FROM taxonomy_term_data WHERE name = :name AND vid = :vid', $args);