Query with multiple where clause
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);