Einzelnen Beitrag anzeigen

Grolle

Registriert seit: 5. Nov 2004
Ort: Coesfeld
1.268 Beiträge
 
Delphi 2010 Professional
 
#1

Php - MySQL-Datensatz löschen Fehlersuche!

  Alt 22. Mär 2006, 13:55
Hallo!
Ich wähle mit folgendem Script einen Datensatz aus:
Delphi-Quellcode:
<form action = "del2.php" method = "post">
<?php
  include "connect.inc.php";
  $res = mysql_query("select * from adressbuch");
  $num = mysql_num_rows($res);

  echo '<table border="1" cellspacing="0" bordercolordark="white" bordercolorlight="black">';
  echo '<tr> <td>

<font face="Arial" size="2">Auswahl</font></p></td> <td>

<font face="Arial" size="2">Name</font></p></td>
';
  echo '<td>

<font face="Arial" size="2">Vorname</font></p></td> <td>

<font face="Arial" size="2">Strasse</font></p></td>
';
  echo '<td>

<font face="Arial" size="2">PLZ</font></p></td> <td>

<font face="Arial" size="2">Wohnort</font></p></td>
';
  echo '<td>

<font face="Arial" size="2">Telefon</font></p></td> <td>

<font face="Arial" size="2">Fax</font></p></td>
';
  echo '<td>

<font face="Arial" size="2">Mobil</font></p></td> <td>

<font face="Arial" size="2">E-Mail</font></p></td>
';

  while ($dsatz = mysql_fetch_assoc($res))
     {
        echo "<tr>";
        echo "<td><input type='radio' name='auswahl' value='" . $dsatz["name"] . "'></td>";
        echo '<td>

<font face="Arial" size="2">' . $dsatz["name"] . "</font></p></td>";
        echo '<td>

<font face="Arial" size="2">' . $dsatz["vorname"] . "</font></p></td>";
        echo '<td>

<font face="Arial" size="2">' . $dsatz["strasse"] . "</font></p></td>";
        echo '<td>

<font face="Arial" size="2">' . $dsatz["plz"] . "</font></p></td>";
        echo '<td>

<font face="Arial" size="2">' . $dsatz["wohnort"] . "</font></p></td>";
        echo '<td>

<font face="Arial" size="2">' . $dsatz["telefon"] . "</font></p></td>";
        echo '<td>

<font face="Arial" size="2">' . $dsatz["fax"] . "</font></p></td>";
        echo '<td>

<font face="Arial" size="2">' . $dsatz["mobil"] . "</font></p></td>";
        echo '<td>

<font face="Arial" size="2">' . $dsatz["mail"] . "</font></p></td>";
        echo "</tr>";

     }


  // Tabellenende
  echo "</table>";

?>
   



   <input type="submit" value="Datensatz l&ouml;schen">

</form>
Die del2.php die den Datensatz eigentlich löscht sieht so aus:
Delphi-Quellcode:
<html>

<head>
<title>MD Adressbuch 2006 web</title>
</head>

<body>

<?php

if (isset($auswahl))
   {
      include "connect.inc.php";
      $sqlab = "delete from adressbuch where name = $auswahl";
      mysql_query($sqlab);
      $num = mysql_affected_rows();
      if ($num>0)
        echo "Der Datensatz wurde gelöscht!

";
      else
        echo "Der Datensatz wurde nicht gelöscht!

";
   }

else
  echo "Es wurde kein Datensatz ausgewählt!

";
?>

[url="del.php"]Weitere Datensätze löschen...[/url]




[url="index.php"]Zurück zur Übersicht...[/url]


</body>

</html>
Das Problem ist, dass der Datensatz nicht gelöscht wird. Das wird auch so angezeigt.
Wo liegt der Fehler?

Viele Grüße...

  Mit Zitat antworten Zitat