<?php

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

ini_set('display_errors', 1);
error_reporting(E_ALL);	

// old database
/*
$connection=mysql_connect('localhost', 'root', '1234') or die ("Verbindungsversuch fehlgeschlagen");
mysql_select_db('intelectra_shop__', $connection) or die("Konnte die Datenbank nicht waehlen.1");
*/
$connection=mysql_connect('localhost', 'int-db-sql-shop', 'Msc7t24?381L') or die ("Verbindungsversuch fehlgeschlagen");
mysql_select_db('webshop-sql', $connection) or die("Konnte die Datenbank nicht waehlen.1");

echo "get items<br>";
// get items
$sql = "SELECT i.id, i.detail_description, iim.beschreibung FROM import_item_merkmale iim
LEFT JOIN items i ON i.old_id=iim.lid
WHERE iim.mid=77
";
$query = mysql_query($sql) 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
				detail_description=CONCAT(detail_description,'".mysql_real_escape_string('<br>'.$object->beschreibung)."')
                        WHERE id='".$object->id."'
		";
		$query = mysql_query($sql);
		if (!$query) {
			echo $sql;
			echo "<br />";
		}
	
	
	
}
echo "ende<br>";


?>