db_query - Get all nid in more than one nodetype This is a simple query , but i really dont know why its not working. I think the problem is with single quote used!

$type = array('node_type_1', 'node_type_2', 'node_type_3');
$placeholders = db_placeholders($type, 'text');
$query = "SELECT nid FROM {node} WHERE uid = %d AND type IN ($placeholders) AND status = 1 ORDER BY nid DESC";
$result = pager_query($query, 10, 0, NULL, $user-&gt;uid, $type);


It tried this also

$result = pager_query($query, 10, 0, NULL, $user-&gt;uid, implode(', ',$type);


I am getting error

warning: mysql_real_escape_string() expects parameter 1
The correct way to use db_placeholders() with page_query() is shown in taxonomy_select_nodes(). In your case, the code should be the following one.

$type = array('node_type_1', 'node_type_2', 'node_type_3');
$placeholders = db_placeholders($type, 'text');
$args = array_merge(array($user-&gt;uid), $type);

$query = "SELECT nid FROM {node} WHERE uid = %d AND type IN ($placeholders) AND status = 1 ORDER BY nid DESC";
$result = pager_query($query, 10, 0, NULL, $args);