<?php

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

// get data
// connect import database
ini_set('display_errors', 1);
	error_reporting(E_ALL);
echo "start";
// old database
$connection=mysql_connect('localhost', 'root', '1234') or die ("Verbindungsversuch fehlgeschlagen");
mysql_select_db('intelectra', $connection) or die("Konnte die Datenbank nicht waehlen1.");

// get customers
$query = mysql_query('SELECT * FROM `structure` where parent_id=357') or die("Anfrage nicht erfolgreich");
$data = array();
while($obj = mysql_fetch_object($query)) {
	$data[] = $obj;
}

foreach ($data as $menu) {
                $sql = "
			INSERT INTO `site_content` (`structure_id`, `type`, `position`, `activ`, `content`, `configuration`) VALUES
			(".$menu->id.", 'textbox', 1, 0, '', NULL),
			(".$menu->id.", 'slider', 2, 0, '', NULL),
			(".$menu->id.", 'article_list', 5, 1, '0', NULL),
			(".$menu->id.", 'banner', 4, 0, '0', NULL),
			(".$menu->id.", 'manufacturers', 6, 1, '', NULL),
			(".$menu->id.", 'substructure', 3, 1, '', "."\"\$config = array\('cat_id' => '', 'ebenen' => '2', \)\;\""."),
			(".$menu->id.", 'popular', 0, 0, '', NULL)
                ";        
		$sql = "
			INSERT INTO `site_content` (`structure_id`, `type`, `position`, `activ`, `content`, `configuration`) VALUES
			(".$menu->id.", 'textbox', 1, 0, '', NULL),
			(".$menu->id.", 'slider', 2, 0, '', NULL),
			(".$menu->id.", 'article_list', 5, 1, '0', NULL),
			(".$menu->id.", 'banner', 4, 0, '0', NULL),
			(".$menu->id.", 'manufacturers', 6, 1, '', NULL),
			(".$menu->id.", 'substructure', 3, 1, '', "."\"\$config = array\('cat_id' => '', 'ebenen' => '2', \)\;\""."),
			(".$menu->id.", 'popular', 0, 0, '', NULL)
	";        
        echo $sql.'<br>';
	//$query = mysql_query($sql);
}
