Files
crm.twinpol.com/import/import/change_index.php
2025-05-12 15:44:39 +00:00

46 lines
1.0 KiB
PHP
Executable File

<?php
include_once("class.dbf.php");
include_once("/var/www/crm/config.php");
include_once("helper.php");
global $sugar_config;
$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;");
$path = dirname(__FILE__).'/_indeksy.dbf';
$dbfp = new dbf_class($path);
$num_recp=$dbfp->dbf_num_rec;
for($i=0;$i<$num_recp;$i++){
if ($i % 5000 == 0) echo $i.'
';
$rowp=$dbfp->getRowAssoc($i);
//get id
$r = mysql_fetch_array(mysql_query("SELECT id FROM ecmproducts WHERE index_dod='".$rowp['INDEKS']."'"));
$id = $r['id'];
if ((!isset($id)) || ($id=='')) {
echo 'nie ma
';
continue;
}
//update ecmproducts
$q=ch("update ecmproducts set name='".addslashes($rowp['NAZWA'])."' where id='$id'");
mysql_query($q);
//update ecmstockstartes
//$q="update ecmstockstates set product_code='".$rowp['INDEKS_DOD']."' where product_id='$id'";
//mysql_query($q);
}
?>