shop-old/scripts/imports/import_metadata.php
2026-04-20 01:03:43 +02:00

53 lines
1.5 KiB
PHP

<?php
//ini_set("memory_limit","1024M");
set_time_limit(6000000);
// get data
// connect import database
// 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");
echo "get data<br>";
// get items
$query = mysql_query('SELECT * FROM passendwie') 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
attribute_1=CONCAT_WS(';', attribute_1, '".mysql_real_escape_string($object->vertreiber)."'),
attribute_2=CONCAT_WS(';', attribute_2, '".mysql_real_escape_string($object->bestellcode)."')
WHERE number='".$object->nr."'
";
*/
$content ='<p>';
$content .= '<b>'.$object->vertreiber.'</b>';
if ($object->bestellcode) {
$content .= '<br>'.$object->bestellcode;
}
$content .='</p>';
$sql = "
UPDATE items
SET
attribute_1=CONCAT_WS('', attribute_1, '".mysql_real_escape_string($content)."'),
attribute_2=''
WHERE number='".$object->nr."'
";
$query = mysql_query($sql);
if (!$query) {
echo $sql;
echo "<br />";
}
}
echo "ende<br>";
?>