D
danex
Hallo,
ich habe die suchfunktion benutzt, auch ca. gefunden was ich will, aber ich bekomme es einfach nicht hin, neben der Spalte "Datum/Uhrzeit" eine zusätzlich Spalte einzufügen. In dieser Zeile soll ein Link/Button sein, um genau diesen Datensatz zu löschen.
Bitte helft mir, ich verzweifel schon seit Tagen, bitte helft einem Anfänger weiter =(
ich habe die suchfunktion benutzt, auch ca. gefunden was ich will, aber ich bekomme es einfach nicht hin, neben der Spalte "Datum/Uhrzeit" eine zusätzlich Spalte einzufügen. In dieser Zeile soll ein Link/Button sein, um genau diesen Datensatz zu löschen.
Bitte helft mir, ich verzweifel schon seit Tagen, bitte helft einem Anfänger weiter =(
PHP:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Yard Database</title>
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
font-size: 24px;
{color: #FF6600};
}
-->
body {
background-color: #CCCCCC;
}
.style3 {color: #FF6600}
.style5 {color: #000000; font-size: 24px; }
.style6 {
font-size: 36px;
color: #FF6600;
}
</style>
</head>
<body>
<div align="center">
<h1 class="style1"><span class="style6">Y</span><span class="style1">ard <span class="style6">D</span>atabase</span> </h1>
<h1 class="style1">
</h1>
</div>
</body>
<hr>
</html>
<br>
<?php
if (isset($_POST['submit']) && isset($_POST['kfz']) && $_POST['kfz'] != '' ) {
try {
$db = new MySQLi('localhost', 'danex', 'aischane', 'yard');
$sql = 'INSERT INTO yard (kfz, frachtfr, fahrtnr, wb1, wb2, time) VALUES (?, ?, ?, ?, ?, ?)';
$kommando = $db->prepare($sql);
$kommando->bind_param('ssssss', $_POST['kfz'], $_POST['frachtfr'], $_POST['fahrtnr'], $_POST['wb1'], $_POST['wb2'], $datum);
$datum = $_POST['date'];
$kommando->execute();
$db->close();
} catch (Exception $e) {
echo 'Fehler: ' . htmlspecialchars($e->getMessage());
}
}
?>
<style type="text/css">
<!--
.style9 {
font-size: 18px;
font-weight: normal;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style5 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: normal; font-size: 16px; }
-->
</style>
</head>
<body>
<form method="POST">
<table width="636" border="1" align="center" cellpadding="0" cellspacing="0">
<tr bordercolor="#999999" bgcolor="#999999">
<td height="42" bgcolor="#FF6600"><span class="style9">Kennzeichen: </span></td>
<td height="42" bgcolor="#FF6600"><input type="text" name="kfz" /></td>
<td width="89" bgcolor="#FF6600"><span class="style9">Frachtführer: </span></td>
<td width="147" bgcolor="#FF6600"><span class="style5">
<input name="frachtfr" type="text" />
</span></td>
<td width="147" rowspan="3" bgcolor="#FF6600">
<div align="center">
<input name="submit" type="submit" value="Eintragen!"
font-family:Verdana, Arial, Helvetica, sans-serif;font-weight:bold;font-size: 30px;">
</div></td>
</tr>
<tr bgcolor="#999999">
<td width="126" height="42"><span class="style5">Brücke 1: </span></td>
<td width="144"><span class="style5">
<input type="text" name="wb1" />
</span></td>
<td class="style5">Fahrt-Nr.: </td>
<td><input name="fahrtnr" type="text" /></td>
</tr>
<tr bgcolor="#999999">
<td height="42"><span class="style5">Brücke 2:</span></td>
<td><input name="wb2" type="text" /></td>
<td colspan="2"> </td>
</tr>
</table>
</form>
<hr>
</body>
</html>
<table>
<table width="700" height="100" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#999999">
<tr><th><span class="style5">#</th><th><span class="style5">Kennzeichen</th><th><span class="style5">Frachtführer</th><th><span class="style5">Fahrten-Nr</th><th><span class="style5">Brücke 1</th><th><span class="style5">Brücke 2</th><th><span class="style5">Datum/Uhrzeit</th><th><a href='yard.php?del=$ID'Loeschen<a/></th></tr>
<?php
try {
$db = new MySQLi('localhost', 'danex', 'aischane', 'yard');
$sql = 'SELECT * FROM yard';
$kommando = $db->prepare($sql);
$kommando->execute();
$kommando->bind_result($id, $kfz, $frachtfr, $fahrtnr, $wb1, $wb2, $time);
while ($kommando->fetch()) {
printf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
$id, htmlspecialchars($kfz), htmlspecialchars($frachtfr), htmlspecialchars($fahrtnr), $wb1, $wb2, $time);
}
$db->close();
} catch (Exception $e) {
echo 'Fehler: ' . htmlspecialchars($e->getMessage());
}
?>
</table>