<?php
header ("Content-Type:text/xml");
include "start.php";
echo "<psync>";
//---------------------------------------------------------------------------------------------------------
  
//===========================customer================================================  
           

    $query_addon = "select * from t_".$key_table_prefix."_addon
                      ";
				  //where client_id = '".$client_id."';
    $result_addon = mysqli_query($dbconn,$query_addon);
    while($line_addon = mysqli_fetch_array($result_addon,MYSQLI_ASSOC))
    {
        $addon_data[$line_addon["add_code"]] = $line_addon["add_id"];
    }
    
    $query_product = "select * from t_".$key_table_prefix."_product
                      ";
				  //where client_id = '".$client_id."';
    $result_product = mysqli_query($dbconn,$query_product);
    while($line_product = mysqli_fetch_array($result_product,MYSQLI_ASSOC))
    {
        $product_data[$line_product["pdt_code"]] = $line_product["pdt_id"];
    }       
           
           
  
    $query_sync="INSERT INTO
                    t_".$key_table_prefix."_addon_assignment
                    (
                    asg_addon_id,
                    asg_product_id,
                    
                    created_date,
                    modified_date,
                    
                    client_id
                    )
                    VALUES
                    (
                    
                    '".$addon_data[$_REQUEST["addon_code"]]."',
                    '".$product_data[$_REQUEST["product_code"]]."',
                    
                    
                    
                    '".$_REQUEST["created_date"]."',
                    '".$_REQUEST["modified_date"]."',
                    
                    '".$client_id."'
                    )
                    ;
                    ";
    $result_sync = mysqli_query($dbconn,$query_sync) or die("Error ".mysqli_error($dbconn));
    
                        
                        
                        
                                    
echo "<upload>
";
echo "<status>SUCCESS</status>
";
echo "<message>".str_replace("&","&amp;","Upload Successful")."</message>
";
echo "</upload>
";

         


//---------------------------------------------------------------------------------------------------------
echo "</psync>";
?>