How to return all the tags from a specific vocabulary for the current node
arg() returns a string so $nid is not an object. You're currently adding your :node_nid database condition with a value of $nid-&gt;nid, when you should just be using $nid:

$vid = 1;  
$nid = arg(1);

// Updated as per comments below
$sql = 'SELECT t.name FROM {taxonomy_term_data} t INNER JOIN {taxonomy_index} r ON r.tid = t.tid WHERE t.vid = :vid AND r.nid = :node_nid ORDER BY weight';
$args = array(':vid' =&gt; $vid, ':node_nid' =&gt; $nid);

$terms = db_query($sql, $args)-&gt;fetchCol();
$comma_separated = implode(', ', $terms);


If you want to load the node object related to the current path then you can use menu_get_object(); then you can access the nid as part of the object:

$node = menu_get_object();
$nid = $node-&gt;nid;


But I suspect that will be overkill as you only really need the $nid, and not the full node object for your query.