db_update query does not work properly I work with views bulk operations and I wanna change status of selected items in a view. I applied db_update query, but something went wrong. I was debugging my code following:

  $status=$context['status'];


foreach($context['rows'] as $order) {

    db_update('orders')
        -&gt;fields(array(
            'status' =&gt; $status
        ))
        -&gt;condition('oid',$order-&gt;oid,'=')
        -&gt;execute();
}



foreach($context['rows'] as $order) {
    $result = db_select('orders','status')
        -&gt;fields('status')
        -&gt;condition('oid',$order-&gt;oid)
        -&gt;execute()
        -&gt;fetchAssoc();
    if($result) {
        drupal_set_message($result['status']);
        drupal_set_message($result['oid']);
    }
}


So first is db_update and after that I did db_select and printed it out.The result of this db_select behaves like status would be updated. But in the node is status still the same. Also in database it stayed unchanged. I have no idea what's wrong. It behaves like it was updated and then immediately got back.I would be very helpful for any help. Sorry for my english. Thanks.
My first inclination is that this is a caching issue.

Other possibilities:


Is the node actually stored in the orders table?  Do you do the appropriate updates for the nodes table as well?
Is this in an incomplete transaction?  (db_transaction)
Have you checked the return value of the -&gt;execute() to see if it is returning the right number of rows?


Without a full description of what the variable $context and the table orders contains, it is hard to give any better answers.