CoverUnder
Mitglied
Die komplette Datei:
PHP:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Datenbankverbindung herstellen
include ('../../includes/configure.php');
$mysqlhost = DB_SERVER;
$mysqluser = DB_SERVER_USERNAME;
$mysqlpassword = DB_SERVER_PASSWORD;
$mysqldb = DB_DATABASE;
$mysql = mysql_connect($mysqlhost, $mysqluser, $mysqlpassword);
$selectdb = mysql_select_db($mysqldb);
if(!$mysql) {
echo("Keine Verbindung zum MySQL-Server möglich<br/ >".mysql_error());
}
if(!$mysqldb) {
echo("Konnte Datenbank nicht Auswählen<br />".mysql_error());
}
$aktuelles_jahr = date("y");
$aktuelles_monat = date("m");
$timestamp = strtotime("-1 months");
$letzter_monat = date("y-m", $timestamp);
//Header
include("kundenliste_head.html");
// Liest die Kunden aus, die in der Tabelle orders nicht vorkommen
$sql="SELECT k.customers_id, k.customers_firstname, k.customers_lastname, k.customers_gender, k.customers_email_address, k.customers_date_added, i.customers_info_date_of_last_logon FROM customers_info AS i, customers AS k LEFT JOIN orders AS b ON k.customers_id = b.customers_id WHERE customers_info_date_of_last_logon < DATE_SUB(NOW() , INTERVAL 7 DAY) AND b.customers_id IS NULL ORDER BY customers_info_date_of_last_logon ASC";
$res = mysql_db_query($mysqldb, $sql, $mysql) or die("Error:\r Query: ".$sql."\r\r Error-Message: " mysql_error());
while ($row = mysql_fetch_assoc($res)) {
$customers_id = $row['customers_id'];
$customers_firstname = $row['customers_firstname'];
$customers_lastname = $row['customers_lastname'];
$customers_gender = $row['customers_gender'];
$customers_email_address = $row['customers_email_address'];
$customers_date_added = $row['customers_date_added'];
//Prüft das Geschlecht
if($customers_gender == "m")
{
$customers_gender = "Herr";
}
elseif($customers_gender == "f")
{
$customers_gender = "Frau";
}
//Schaut, ob Sachen im Warenkorb sind
$anzahl_sql = mysql_db_query($mysqldb, "SELECT * FROM customers_basket WHERE customers_id = '$customers_id'");
$anzahl = mysql_num_rows($anzahl_sql);
if($anzahl != '0')
{ $wako = "JA"; }
else { $wako = "Nein"; }
include("kundenliste.html");
}
//Footer
include("liste_bearbeitet_foot.html");
mysql_close($mysql);
?>