28 lines
902 B
PHP
28 lines
902 B
PHP
<?php
|
|
|
|
//ini_set("memory_limit","1024M");
|
|
//set_time_limit(60000);
|
|
|
|
// get data
|
|
// connect import database
|
|
|
|
$connection=mysql_connect('localhost', 'emfa_kinderwelt_', 'sgfed/(&RT') or die ("Verbindungsversuch fehlgeschlagen");
|
|
mysql_select_db('emfa_kinderwelt_',$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)) {
|
|
$sql = "INSERT INTO item_structure_assign (item_id, structure_id) VALUES (".$obj->id.", ".$obj->{'structure_id'}.")";
|
|
$result = mysql_query($sql);
|
|
for ($i=2;$i<11;$i++) {
|
|
if ($obj->{'structure_id_'.$i} > 0) {
|
|
$sql = "INSERT INTO item_structure_assign (item_id, structure_id) VALUES (".$obj->id.", ".$obj->{'structure_id_'.$i}.")";
|
|
$result = mysql_query($sql);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
echo "ende";
|
|
?>
|