<?php 
	require(__DIR__.'/connect.php');  break; // listo
	$db = new connect('visionwe_mateckoriginal','visionwe_matecku','7Z}jf_6}{KZ]');
	$mateck = new connect('visionwe_mateckkdb','visionwe_matecku','7Z}jf_6}{KZ]');
	$query ="
		SELECT * FROM products_to_categories order by products_id asc, categories_id asc 
			";
	$categorias = $db->getRows($query); 
	$produ = 0;
	foreach($categorias as $categoria):
		$producto = $categoria['products_id'];
		$categoria1 = $categoria['categories_id']+1;
		
		if($produ!=$producto){
			$sql="UPDATE ax_product SET id_category_default = '$categoria1' where id_product ='$producto'";
			$mateck->insertRow($sql);
			$sql="UPDATE ax_product_shop SET id_category_default = '$categoria1' where id_product ='$producto'";
			$mateck->insertRow($sql);
		}		
		
		$sql="insert into ax_category_product(id_category, id_product, position) values('$categoria1', '$producto', 1)";
		echo $sql.'<br/>'; 
		$mateck->insertRow($sql);
		$produ = $producto;
		echo "$categoria1 - $producto - registrado OK.<br/> ";
	endforeach;
		
	echo "Fin de transferencia"
	
	
	
	
	
	
	
	
	
	
?>	