<?php

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

// get data
// connect import database

$connection=mysql_connect('localhost', 'test_hawi_aquari', 'Y*AXzD6c') or die ("Verbindungsversuch fehlgeschlagen");
mysql_select_db('test_hawi_aquaristik', $connection) or die("Konnte die Datenbank nicht waehlen.");
echo "get items";
$query = mysql_query('SELECT * FROM items') or die("Anfrage nicht erfolgreich");
$data = array();
echo "set structures";
while ($obj = mysql_fetch_object($query)) {
	if ($obj->inventory > 0) {
		$sql = "INSERT INTO item_inventory
			(
				item_id, 
				item_number, 
				item_name, 
				inventory_object_type_id, 
				inventory_object_id, 
				amount, 
				created
			) VALUES (
				'".$this->db->real_escape_string($obj->id)."',
				'".$this->db->real_escape_string($obj->number)."',
				'".$this->db->real_escape_string($obj->name)."',
				2,
				0,
				'".$this->db->real_escape_string($obj->inventory)."',
				CURRENT_TIMESTAMP
			)
		";
		$result = mysql_query($sql);
	}
}
echo "ende";
?>