article_overview.php aktualisiert
This commit is contained in:
parent
259178e7d4
commit
97d3e86652
|
@ -38,6 +38,7 @@
|
|||
<li><a href="index.php">Home</a></li>
|
||||
<li><a href="add_material_form.php">Artikel hinzufügen</a></li>
|
||||
<li><a href="article_overview.php">Artikel Übersicht</a></li>
|
||||
<li><a href="backup_restore.php">Backup</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -67,31 +68,34 @@
|
|||
<th>Aktionen</th>
|
||||
</tr>
|
||||
<?php
|
||||
// Datenbankverbindung herstellen
|
||||
include_once 'config/config.php';
|
||||
// Protokollierungsereignis einbinden
|
||||
include_once 'log_event.php';
|
||||
|
||||
// Verbindung zur Datenbank herstellen
|
||||
$conn = new mysqli($host, $username, $password, $database);
|
||||
if ($conn->connect_error) {
|
||||
// Datenbankverbindung herstellen
|
||||
include_once 'config/config.php';
|
||||
|
||||
// Verbindung zur Datenbank herstellen
|
||||
$conn = new mysqli($host, $username, $password, $database);
|
||||
if ($conn->connect_error) {
|
||||
die("Verbindung zur Datenbank fehlgeschlagen: " . $conn->connect_error);
|
||||
}
|
||||
}
|
||||
|
||||
// SQL-Abfrage vorbereiten
|
||||
$sql = "SELECT * FROM materials";
|
||||
// SQL-Abfrage vorbereiten
|
||||
$sql = "SELECT * FROM materials";
|
||||
|
||||
// Wenn nach einem Artikel gesucht wird
|
||||
if(isset($_GET['search']) && !empty($_GET['search'])){
|
||||
// Wenn nach einem Artikel gesucht wird
|
||||
if(isset($_GET['search']) && !empty($_GET['search'])){
|
||||
$search = $_GET['search'];
|
||||
$sql .= " WHERE
|
||||
item_name LIKE '%" . $search . "%' OR
|
||||
manufacturer LIKE '%" . $search . "%' OR
|
||||
location LIKE '%" . $search . "%' OR
|
||||
barcode LIKE '%" . $search . "%'";
|
||||
}
|
||||
}
|
||||
|
||||
$result = $conn->query($sql);
|
||||
$result = $conn->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
if ($result->num_rows > 0) {
|
||||
// Daten ausgeben
|
||||
while($row = $result->fetch_assoc()) {
|
||||
$expiration_date = date("d.m.Y", strtotime($row["expiration_date"]));
|
||||
|
@ -144,12 +148,19 @@ if ($result->num_rows > 0) {
|
|||
<input type='submit' value='Speichern'>
|
||||
</form>
|
||||
</td></tr>";
|
||||
|
||||
// Loggen des Löschens eines Artikels
|
||||
echo "<script>function confirmDelete" . $row["id"] . "() {
|
||||
if(confirm('Möchten Sie diesen Artikel wirklich löschen?')) {
|
||||
window.location.href = 'remove_article.php?id=" . $row["id"] . "';
|
||||
}
|
||||
} else {
|
||||
}</script>";
|
||||
}
|
||||
} else {
|
||||
echo "<tr><td colspan='9'>Keine Artikel gefunden</td></tr>";
|
||||
}
|
||||
$conn->close();
|
||||
?>
|
||||
}
|
||||
$conn->close();
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue