Files
crm.twinpol.com/modules/EcmStockStates/check_products.php
2025-05-12 15:44:39 +00:00

30 lines
764 B
PHP
Executable File

<?php
set_time_limit(9999999999);
include_once("class.dbf.php");
include_once("helper.php");
$sql=mysql_connect("localhost","root","");
mysql_select_db("saascrm");
mysql_query("set names utf8");
//$w=mysql_query("select id,name,dir from ecmstocks where deleted='0'");
//while($r=mysql_fetch_array($w)){
$dbf = new dbf_class("klk/".$r['dir']."/_stany.dbf");
$num_rec=$dbf->dbf_num_rec;
$n=0;
for($i=0;$i<$num_rec;$i++){
$row = $dbf->getRowAssoc($i);
$index=iconv("CP852","UTF-8",$row['INDEKS']);
$nazwa=$row['NAZWA'];
if(mysql_num_rows(mysql_query("select name from ecmproducts where code like '".$index."' and deleted='0'"))==0){
echo $index." ".$nazwa."\n";
addProduct($index,$nazwa);
$n++;
}
}
echo $n;
//}
mysql_close($sql);
?>