<?php

//ini_set("memory_limit","1024M");
//set_time_limit(60000);

// get data
// connect import database

// old database
$connection=mysql_connect('localhost', 'root', '1234') or die ("Verbindungsversuch fehlgeschlagen");
mysql_select_db('intelectra', $connection) or die("Konnte die Datenbank nicht waehlen.1");

echo "get data<br>";
// get items
$query = mysql_query('SELECT * FROM passendwie') or die("Anfrage nicht erfolgreich");
$data = array();
while($obj = mysql_fetch_object($query)) {
	$data[] = $obj;
}

echo "imports<br>";
foreach ($data as $object) {
		$sql = "
			UPDATE items
			SET
				attribute_1=CONCAT_WS(';', attribute_1, '".mysql_real_escape_string($object->vertreiber)."'),
                                attribute_2=CONCAT_WS(';', attribute_2, '".mysql_real_escape_string($object->bestellcode)."')
                        WHERE number='".$object->nr."'
		";
		$query = mysql_query($sql);
		if (!$query) {
			echo $sql;
			echo "<br />";
		}
}

echo "ende<br>";

?>