programatically find unpublished node count in drupal I have a task to find how many node are unpublished in a particular content type. Have to use the count for some other purposes.

How can I do that?
You just want to query the node table for example 

here a sample function sent the content type machine name to this function will give you unpublished node count:    

function get_unpublish_node_count($type){
            $db_query = db_select('node','n')
            -&gt; fields('n',array('nid'))
            -&gt; condition('n.status',0,'=')
            -&gt; condition('n.type',$type,'=')
            $result = $db_query-&gt;countQuery()-&gt;execute()-&gt;fetchField();
            return $result;
}


Same function you can use this for published node count

function get_publish_node_count($type){
            $db_query = db_select('node','n')
            -&gt; fields('n',array('nid'))
            -&gt; condition('n.status',1,'=')
            -&gt; condition('n.type',$type,'=')
            $result = $db_query-&gt;countQuery()-&gt;execute()-&gt;fetchField();
            return $result;
} 


just change the status to "1" will give you published node count 

Hope this helps :)