Associate Simple Product to Configurable Product
<p>Hi I am able to associate simple product to Configurable Product.
Using Code:</p>

<pre><code>&lt;?php
    require_once('app/Mage.php'); //Path to Magento
     umask(0);
     Mage::app();
    $productId= 86971;
    $productCollection = Mage::getResourceModel('catalog/product_collection')
            -&gt;addAttributeToSelect('*')
            -&gt;addAttributeToFilter('type_id','configurable')
             -&gt;load($productId); 

   foreach ($productCollection as $product) {
           $simpleProductIds = array('35683'); // Simple product Ids
       Mage::getResourceSingleton('catalog/product_type_configurable')
       -&gt;saveProducts($product, $simpleProductIds);
}

?&gt;
</code></pre>

<hr>

<p>But whenever I associate new simple product to configurable product, I am loosing old associated product. Can you please help me out on this.</p>

<p>Thank You in Advance</p>