article_overview.php aktualisiert
This commit is contained in:
parent
76d1d4ce71
commit
1028785807
|
@ -67,35 +67,36 @@
|
||||||
<th>Aktionen</th>
|
<th>Aktionen</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
// Datenbankverbindung herstellen
|
// Datenbankverbindung herstellen
|
||||||
include_once 'config/config.php';
|
include_once 'config/config.php';
|
||||||
|
|
||||||
// Verbindung zur Datenbank herstellen
|
// Verbindung zur Datenbank herstellen
|
||||||
$conn = new mysqli($host, $username, $password, $database);
|
$conn = new mysqli($host, $username, $password, $database);
|
||||||
if ($conn->connect_error) {
|
if ($conn->connect_error) {
|
||||||
die("Verbindung zur Datenbank fehlgeschlagen: " . $conn->connect_error);
|
die("Verbindung zur Datenbank fehlgeschlagen: " . $conn->connect_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SQL-Abfrage vorbereiten
|
// SQL-Abfrage vorbereiten
|
||||||
$sql = "SELECT * FROM materials";
|
$sql = "SELECT * FROM materials";
|
||||||
|
|
||||||
// Wenn nach einem Artikel gesucht wird
|
// Wenn nach einem Artikel gesucht wird
|
||||||
if(isset($_GET['search']) && !empty($_GET['search'])){
|
if(isset($_GET['search']) && !empty($_GET['search'])){
|
||||||
$search = $_GET['search'];
|
$search = $_GET['search'];
|
||||||
$sql .= " WHERE
|
$sql .= " WHERE
|
||||||
item_name LIKE '%" . $search . "%' OR
|
item_name LIKE '%" . $search . "%' OR
|
||||||
manufacturer LIKE '%" . $search . "%' OR
|
manufacturer LIKE '%" . $search . "%' OR
|
||||||
location LIKE '%" . $search . "%' OR
|
location LIKE '%" . $search . "%' OR
|
||||||
barcode LIKE '%" . $search . "%'";
|
barcode LIKE '%" . $search . "%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $conn->query($sql);
|
$result = $conn->query($sql);
|
||||||
|
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
// Daten ausgeben
|
// Daten ausgeben
|
||||||
while($row = $result->fetch_assoc()) {
|
while($row = $result->fetch_assoc()) {
|
||||||
$expiration_date = date("d.m.Y", strtotime($row["expiration_date"]));
|
$expiration_date = date("d.m.Y", strtotime($row["expiration_date"]));
|
||||||
$ten_days_before_expiry = date("d.m.Y", strtotime("-10 days", strtotime($row["expiration_date"]))); // 10 Tage vor dem Ablaufdatum
|
$notification_days = intval($row["notification_days"]); // Tage vor dem Ablaufdatum aus der Datenbank lesen
|
||||||
|
$ten_days_before_expiry = date("d.m.Y", strtotime("-" . $notification_days . " days", strtotime($row["expiration_date"]))); // Tage vor dem Ablaufdatum berechnen
|
||||||
$current_date = date("d.m.Y"); // Aktuelles Datum
|
$current_date = date("d.m.Y"); // Aktuelles Datum
|
||||||
|
|
||||||
echo "<tr";
|
echo "<tr";
|
||||||
|
@ -144,11 +145,11 @@
|
||||||
</form>
|
</form>
|
||||||
</td></tr>";
|
</td></tr>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "<tr><td colspan='9'>Keine Artikel gefunden</td></tr>";
|
echo "<tr><td colspan='9'>Keine Artikel gefunden</td></tr>";
|
||||||
}
|
}
|
||||||
$conn->close();
|
$conn->close();
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue