PHP gibt hier keine Fehlermeldung raus, sond löscht die Daten einfach nicht .. Wie könnte ich das anders machen, oder was muss ich anders machen damit dieses Programm funktioniert :
<?php
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'root');
define('MYSQL_PASS', '');
define('MYSQL_DB', 'test');
mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS) OR die("Fehler: ".mysql_error());
mysql_select_db(MYSQL_DB) OR die("Fehler: ".mysql_error());
$anzahl = 1;
$alles = "SELECT ID, Name, Alteer, Hobby, Beruf FROM auslesen";
$weiter = mysql_query($alles);
echo "<form action=schmeiss.php method=post>";
echo "<table border=2><tr><td><b> Nr. </b></td><td><b> Name </b></td><td><b> Alter </b></td><td><b> Hobby </b></td><td><b> Beruf </b></td><td><b>löschen</b></td></tr>";
while($fertig = mysql_fetch_assoc($weiter))
{
$id = $fertig['ID'];
echo "<tr><td> ";
echo $anzahl;
echo " </td><td> ";
echo $fertig['Name'];
echo " </td><td> ";
echo $fertig['Alteer'];
echo " </td><td> ";
echo $fertig['Hobby'];
echo " </td><td> ";
echo $fertig['Beruf'];
echo " </td><td> ";
echo "<input type=checkbox name=$id>";
echo " </td></tr> ";
$anzahl++;
}
echo "</table>";
echo "<input type=submit value='entgültig löschen'>";
echo "</form>";
echo "<a href=start.html>Zurück zum Formular</a>";
?>
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'root');
define('MYSQL_PASS', '');
define('MYSQL_DB', 'test');
mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS) OR die("Fehler: ".mysql_error());
mysql_select_db(MYSQL_DB) OR die("Fehler: ".mysql_error());
$anzahl = 1;
$alles = "SELECT ID, Name, Alteer, Hobby, Beruf FROM auslesen";
$weiter = mysql_query($alles);
echo "<form action=schmeiss.php method=post>";
echo "<table border=2><tr><td><b> Nr. </b></td><td><b> Name </b></td><td><b> Alter </b></td><td><b> Hobby </b></td><td><b> Beruf </b></td><td><b>löschen</b></td></tr>";
while($fertig = mysql_fetch_assoc($weiter))
{
$id = $fertig['ID'];
echo "<tr><td> ";
echo $anzahl;
echo " </td><td> ";
echo $fertig['Name'];
echo " </td><td> ";
echo $fertig['Alteer'];
echo " </td><td> ";
echo $fertig['Hobby'];
echo " </td><td> ";
echo $fertig['Beruf'];
echo " </td><td> ";
echo "<input type=checkbox name=$id>";
echo " </td></tr> ";
$anzahl++;
}
echo "</table>";
echo "<input type=submit value='entgültig löschen'>";
echo "</form>";
echo "<a href=start.html>Zurück zum Formular</a>";
?>
<?php
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'root');
define('MYSQL_PASS', '');
define('MYSQL_DB', 'test');
mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS) OR die("Fehler: ".mysql_error());
mysql_select_db(MYSQL_DB) OR die("Fehler: ".mysql_error());
$löschen = "DELETE FROM auslesen WHERE ID = $_POST[$id]";
mysql_query($löschen);
echo "<p align=center>";
echo "Datensätze gelöscht!<br>";
echo "<a href=start.html>Zurück zum Formular</a>";
?>
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'root');
define('MYSQL_PASS', '');
define('MYSQL_DB', 'test');
mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS) OR die("Fehler: ".mysql_error());
mysql_select_db(MYSQL_DB) OR die("Fehler: ".mysql_error());
$löschen = "DELETE FROM auslesen WHERE ID = $_POST[$id]";
mysql_query($löschen);
echo "<p align=center>";
echo "Datensätze gelöscht!<br>";
echo "<a href=start.html>Zurück zum Formular</a>";
?>
Danke Spacedone
Einen Kommentar schreiben: