How to publish node from php code? Tried simple query `db_query("UPDATE {node} SET status = 1 WHERE nid = %d", $nid);` but it doesn't work.
My scenario: By default nodes are unpublished. I'm altering edit-node form to add textfield. If user enters right code node become published. So I adding another submit function in form\_alter and in that function checking code and if it's right trying to update node status to published.