Updating field in external Drupal database I'm working on a project where I have 2 Drupal installations which occasionally need to interact with eachothers database.

So far, I've been able to set up all interactions using db_set_active and db_select/db_query/db_update statements (example below):

db_set_active(.....);
db_select(.....);
db_set_active;


Simple select queries don't pose any problem. And while update queries are being propagated correctly, they have an inherit issue: they don't call the save hooks in the target Drupal installation...

My use case: I'm database updating a boolean CCK field (in Drupal B) from 0 to 1 (through a module script at Drupal A) and Rules (at Drupal B) should trigger on this. Moreover, the field caches aren't cleared so probably going directly through the database isn't a very good way to update the field...

Any other ideas how to update fields from within external scripts? Or maybe how to execute Rules while keeping the database operations?

Thanks
I have achieved the similar functionality with following code. I worked on Drupal 6. But, hopefully it worked for you.

I have two same drupal installation and when creating new node in one installation, I need to create node into another Drupal installation also. So, I customize the node form and added a submit function to node form.

Custom Submit function

function custom_node_export_form_submit($form, $form_state) {

  //Creating node object
  $node = new stdClass;

  foreach ($form_state['values'] as $key =&gt; $value) {
    $node-&gt;$key = $value;    
  }

  db_set_active('domain');

  node_save($node);

  db_set_active('default');  

}