28 lines
1.1 KiB
PHP
28 lines
1.1 KiB
PHP
<?php
|
|
date_default_timezone_set('Europe/Warsaw');
|
|
mb_internal_encoding("UTF-8");
|
|
ini_set('display_errors',1);
|
|
//require_once("../../fkcsv/helper.php");
|
|
$inv='<table cellspacing="0" cellpadding="0" border="0" width="100%">';
|
|
$link = mysql_connect('localhost', 'root', '5z#JaL');
|
|
$db_selected = mysql_select_db('crm', $link);
|
|
mysql_query ("SET NAMES 'utf8'",$link);
|
|
mysql_query("set character set 'utf8'",$link);
|
|
$b=mysql_query("select id,record_id,name from ecmtransactions where deleted=0 and type=0",$link);
|
|
$i=0;
|
|
echo mysql_num_rows($b)."\n";
|
|
while($r=mysql_fetch_array($b)){
|
|
$ac=mysql_query("select id from ecminvoiceoutolds where document_no='".$r['name']."'",$link);
|
|
$i++;
|
|
if(mysql_num_rows($ac)==1){
|
|
$id=mysql_fetch_assoc($ac);
|
|
mysql_query("update ecmtransactions set record_id='".$id['id']."' where id='".$r['id']."'");
|
|
}
|
|
if($i%1000==0) echo $i."\n";
|
|
//s if($r['name']=='') echo $r['id'].' name empty<br>';
|
|
// if($r['ecminvoiceoutold_name']=='') echo $r['id'].'inv empty<br>';
|
|
}
|
|
//echo '<br>'.create_guid();
|
|
$inv.='</table>';
|
|
echo $i;
|
|
?>
|