How can I get the content type of a node given its node ID? I have a URL like track-new/15/51. arg(2) returns 51.

How can I check if the content type of the node whose ID is 51 (the value returned from arg(2)) is 'artist'?
If the value returned from arg(2) is a node ID, you can load the node with node_load(). This will return a node object, which contains its content type.

$node = node_load(arg(2));
$content_type = $node-&gt;type;