How can I prevent placeholders to wrap the value with single quotes in db_query? I want to run a select query using db_query. Here is the code:

$nid_array = array(24,34,56,7,8);
$list_of_nids = implode(',',$nid_array);
$query = "  SELECT *
            FROM {table_name} as t
            WHERE t.nid IN (:list_of_nids)";
$placeholders = array();
$placeholders[':list_of_nids'] = $list_of_nids;

$result = db_query($query, $placeholders)-&gt;fetchAll();


This query does not return any results.
Although if I do not use placeholders &amp; replace :list_of_nids with $list_of_nids, then I get proper results.

I believe that when using placeholders the value of :list_of_nids is taken as the $list_of_nids wrapped with single quote, which is causing problem here.

I want to use placeholders. So, how can use it without wrapping the value with single quotes.
You're imploding your array into a string, so PDO will (correctly) put quotes around it. PDO can handle arrays just fine, though, no need for manual manipulation:

$nid_array = array(24,34,56,7,8);

$query = "  SELECT *
            FROM {table_name} as t
            WHERE t.nid IN (:list_of_nids)";

$placeholders = array();
$placeholders[':list_of_nids'] = $nid_array;

$result = db_query($query, $placeholders)-&gt;fetchAll();