PHP Variables when writing rule
If you simply want to find out what is inside $commerce_order then you can use

&lt;?php echo var_dump($commerce_order);?&gt;


I have made a module in the past that did a simerler thing to what you are trying to do. 
Using Ubercart I created a module that took advantage of the hook_order function.

&lt;?php 
function myFunction_uc_order($ops, &amp;$arg1, $arg2){
    global $user;
    $userId = $user-&gt;uid;
    if ($ops = 'update' &amp;&amp; $arg1-&gt;order_status == "payment_received" &amp;&amp; $arg2 =="completed"){
        $order = uc_order_load($orderId);
        //$order now contains all order information for the current order
    }
}
?&gt;


This code will be run every time an order is "updated", this includes being created. So inside the if you can add your code to export to your 'external' database.

Hope this helps