raybrackho
Mitglied
Ich würde das gerne noch mal aufgreifen hier, da ich leider noch keine Lösung gefunden habe.
Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
<?php
error_reporting(E_ALL);
require_once('config.php');
require_once(DIR_SYSTEM . 'startup.php');
// Registry
$registry = new Registry();
// Loader
$loader = new Loader($registry);
$registry->set('load', $loader);
// Config
$config = new Config();
$registry->set('config', $config);
// Database
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$registry->set('db', $db);
$sql = "SELECT DISTINCT email, customer_id FROM `order` WHERE customer_id > 0";
$query = $db->query($sql);
foreach ($query->rows as $row){
$query2 = $db->query("UPDATE `order` SET customer_id = '". (int)$row['customer_id'] ."' WHERE LCASE(email) = '".strtolower($row['email'])."'");
}
echo 'done';
?>
WHERE customer_id > 0";
-- Alle die eine 0 id und eine gültige ID haben
SELECT
email,
MAX(customer_id) AS newId,
FROM
`order`
GROUP BY
email
HAVING
MAX(customer_id) > 0
AND MIN(customer_id) = 0
UPDATE
`order` AS `old`,
(
SELECT
email,
MAX(customer_id) AS newId,
FROM
`order`
GROUP BY
email
HAVING
MAX(customer_id) > 0
AND MIN(customer_id) = 0
) AS `new`
SET
`old`.customer_id = `new`.new_id
WHERE
`old`.email = `new`.email
AND `old`.customer_id = 0
SELECT
email,
MAX(customer_id) AS newId,
FROM
`order`
GROUP BY
email
HAVING
MAX(customer_id) > 0
AND MIN(customer_id) = 0
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM `order` GROUP BY email HAVING MAX(customer_id) > 0 AND MIN(' at line 4