Created
September 6, 2016 08:43
-
-
Save victor-shelepen/da9f888b573dba195bc9b60dacbee3a3 to your computer and use it in GitHub Desktop.
Example how to use db_update, db_select. Case: Update comment possibility including revisions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
db_update('node') // Table name no longer needs {} | |
->fields(array( | |
'comment' => 1, | |
)) | |
->condition('type', 'feature') | |
->execute(); | |
$subquery = db_select('node') | |
->addField('node', 'nid') | |
->condition('node.type', 'feature', '='); | |
db_update('node_revision') | |
->fields(array('comment' => '2',)) | |
->condition ('node_revision.nid', $subquery, 'IN') | |
->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment