Ich will einen eintrag per PHP aus der DAtenbank löschen
index.php (<form is weiter oben.. ich habe method="PSOT" und action="delete.php"
delete.php
Aber wie krieg ich so jetz die i ID in die delete.php
index.php (<form is weiter oben.. ich habe method="PSOT" und action="delete.php"
PHP-Code:
for ($i = 0; $i < mysql_num_rows($result); $i++)
{
$id = mysql_result($result, $i, "wunschID");
$name = mysql_result($result, $i, "name");
echo '
<tr><td>' . $id . '</td><td>' . $name . '</td><td><input type="checkbox" name="del"></td></tr>
}
PHP-Code:
include('../config/mysql.php');
$connection = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die("Keine Verbindung möglich: " . mysql_error());
mysql_select_db($mysql_db, $connection);
$del = $_POST['del'];
if ($del == 1)
{
$query = "DELTE FROM `wunsch` WHERE `wunschID` = ID";
mysql_query($query, $connection) or die(mysql_error());
}
Kommentar