<?php
/*global $db;
$w=$db->query("select long_description,ecmproduct_id from ecmproduct_language where language='pl' and long_description  like '%&lt;%&gt;%'");
while($r=$db->fetchByAssoc($w)){
	$rc=$db->fetchByAssoc($db->query("select count(*) as c from ecmproduct_language where ecmproduct_id='".$r['ecmproduct_id']."' and language='en'"));
	if($rc['c']>0)$db->query("update ecmproduct_language set long_description='".$r['long_description']."' where ecmproduct_id='".$r['ecmproduct_id']."' and language='en'");
	else {$db->query("insert into ecmproduct_language set 
id='".create_guid()."',
long_description='".$r['long_description']."',
modified_user_id='1',
created_by='1',
date_entered='".date("Y-m-d H:i:s")."',
date_modified='".date("Y-m-d H:i:s")."',
deleted='0',
ecmproduct_id='".$r['ecmproduct_id']."',
language='en',
short_description='',
remarks='',
price=0");
	}
}*/
$sql=mysql_connect("localhost","e5crm.more7.com","5z#JaL");
mysql_select_db("test");

$w=$GLOBALS['db']->query("select short_description,ecmproduct_id from ecmproduct_language where (language like 'en' or language like 'EN') and short_description!='' and short_description is not null");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
	$arr[$r['ecmproduct_id']]=$r['short_description'];
}
mysql_close($sql);

$sql=mysql_connect("localhost","e5crm.more7.com","5z#JaL");
mysql_select_db("e5crm_more7_com");
foreach($arr as $k=>$v){
	echo $v;
	if($GLOBALS['db']->query("update ecmproduct_language set short_description='".$v."' where language='en' and ecmproduct_id='".$k."'")) echo 'ok';
	else echo 'no';
	echo '<br>';
}

mysql_close($sql);
?>