47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
|
|
ini_set("memory_limit","1024M");
|
|
set_time_limit(60000);
|
|
|
|
|
|
|
|
// old database
|
|
$connection=mysql_connect('localhost', 'shop_topreef_de', 'b-7+ZgQn$!') or die ("Verbindungsversuch fehlgeschlagen");
|
|
mysql_select_db('shop_topreef_de', $connection) or die("Konnte die Datenbank nicht waehlen.");
|
|
|
|
echo "get items<br>";
|
|
// get items
|
|
$query = mysql_query('SELECT id, Gewicht FROM item_import') or die("Anfrage nicht erfolgreich");
|
|
$data = array();
|
|
while($obj = mysql_fetch_object($query)) {
|
|
$data[] = $obj;
|
|
}
|
|
|
|
// new database
|
|
$connection=mysql_connect('localhost', 'shop_topreef_de', 'b-7+ZgQn$!') or die ("Verbindungsversuch fehlgeschlagen");
|
|
mysql_select_db('shop_topreef_de', $connection) or die("Konnte die Datenbank nicht waehlen.");
|
|
|
|
|
|
echo "update items<br>";
|
|
foreach ($data as $object) {
|
|
$sql = "
|
|
UPDATE items
|
|
SET
|
|
shipping_weight='".mysql_real_escape_string(str_replace(',', '.', $object->{'Gewicht'}))."'
|
|
WHERE
|
|
id='".$object->id."';
|
|
|
|
";
|
|
echo $sql;echo "<br />";
|
|
$query = mysql_query($sql);
|
|
if (!$query) {
|
|
echo $sql;
|
|
echo "<br />";
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|