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="index.php">Home</a></li>
|
||||||
<li><a href="add_material_form.php">Artikel hinzufügen</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="article_overview.php">Artikel Übersicht</a></li>
|
||||||
|
<li><a href="backup_restore.php">Backup</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,31 +68,34 @@
|
||||||
<th>Aktionen</th>
|
<th>Aktionen</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
// Datenbankverbindung herstellen
|
// Protokollierungsereignis einbinden
|
||||||
include_once 'config/config.php';
|
include_once 'log_event.php';
|
||||||
|
|
||||||
// Verbindung zur Datenbank herstellen
|
// Datenbankverbindung herstellen
|
||||||
$conn = new mysqli($host, $username, $password, $database);
|
include_once 'config/config.php';
|
||||||
if ($conn->connect_error) {
|
|
||||||
|
// Verbindung zur Datenbank herstellen
|
||||||
|
$conn = new mysqli($host, $username, $password, $database);
|
||||||
|
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"]));
|
||||||
|
@ -144,12 +148,19 @@ if ($result->num_rows > 0) {
|
||||||
<input type='submit' value='Speichern'>
|
<input type='submit' value='Speichern'>
|
||||||
</form>
|
</form>
|
||||||
</td></tr>";
|
</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>";
|
echo "<tr><td colspan='9'>Keine Artikel gefunden</td></tr>";
|
||||||
}
|
}
|
||||||
$conn->close();
|
$conn->close();
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue