<?php
include_once("config.php");

$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
mysql_select_db($sugar_config['dbconfig']['db_name']);

mysql_query("set character set utf8;"); 
mysql_query("SET NAMES 'utf8'");

$zap=mysql_query("select t.id,p.description from ecmtransactions as t
join ecmpayments as p on p.id=t.record_id
 where t.record_type='EcmPayments';");
while($dane=mysql_fetch_assoc($zap)){

mysql_query("update ecmtransactions set description='".$dane['description']."' where id='".$dane['id']."'");

}
echo mysql_num_rows($zap);