40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
|
|
ini_set("memory_limit","1024M");
|
|
set_time_limit(600000);
|
|
|
|
// connect import database
|
|
/*$connection=mysql_connect('localhost', 'root', '1234') or die ("Verbindungsversuch fehlgeschlagen");
|
|
mysql_select_db('intelectra_shop__', $connection) or die("Konnte die Datenbank nicht waehlen.");
|
|
*/
|
|
$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";
|
|
$sql = "select * from item_structure_assign where structure_id=10649 and item_id=4";
|
|
$query = mysql_query($sql) or die("Anfrage nicht erfolgreich: $sql");
|
|
$data = array();
|
|
while($obj = mysql_fetch_object($query)) {
|
|
$data['test'.$obj->item_id] = 1;
|
|
}
|
|
|
|
$sql = "select * from items where name like '%Ersatz siehe Alternativartikel%' and id=4";
|
|
$query = mysql_query($sql) or die("Anfrage nicht erfolgreich: $sql");
|
|
while($obj = mysql_fetch_object($query)) {
|
|
if (!isset($data['test'.$obj->id])) {
|
|
$sql = "INSERT INTO item_structure_assign (
|
|
item_id,
|
|
structure_id
|
|
) VALUES (
|
|
".$obj->id.",
|
|
10649
|
|
)";
|
|
$query2 = mysql_query($sql);
|
|
if (!$query2) {
|
|
echo $sql;
|
|
echo "!!<br />";
|
|
}
|
|
}
|
|
}
|
|
echo "ende";
|
|
?>
|