";
// get items
$query = mysql_query('SELECT * FROM item_import') or die("Anfrage nicht erfolgreich");
$data = array();
while($obj = mysql_fetch_object($query)) {
$data[] = $obj;
}
// new database
$connection=mysql_connect('localhost', 'root', '1234') or die ("Verbindungsversuch fehlgeschlagen");
mysql_select_db('topreef', $connection) or die("Konnte die Datenbank nicht waehlen.2");
// tax wrapper
$taxes = array(
'19' => '1',
'7' => '3'
);
echo "get hersteller
";
// get manufacturers
$sql = "SELECT * FROM manufacturers ORDER BY name";
$query = mysql_query($sql);
$manufacturers = array();
while($obj = mysql_fetch_object($query)) {
$manufacturers[$obj->name] = $obj->id;
}
echo "update items
";
foreach ($data as $object) {
$object->{'EK-Preis'} = substr($object->{'EK-Preis'},0,-4);
$object->{'EK-Preis'} = str_replace(",",".",$object->{'EK-Preis'});
$object->{'EK-Preis'} = (float)$object->{'EK-Preis'};
$sql = "
UPDATE items
SET
base_price='".mysql_real_escape_string($object->{'EK-Preis'})."'
WHERE
id='".$object->id."';
";
echo $sql;echo "
";
//$query = mysql_query($sql);
if (!$query) {
echo $sql;
echo "
";
}
}
function price ($p) {
$p = str_replace(',', '.', $p);
$p = substr($p, 0, -2);
return $p;
}
?>