Hi together
I have some problems with the followin PHP Scripts, wich I coded for my Website
when I call the Script it shows me all Entry in the Database (MYSQL) but if I press the "Submit" Button (wich shoud delete the chosen DB Entry --> it makes nothing (only jumps to the Firt Entry in the DB
Whats wrong?
Thanxs very much for your help
Here is the Source-Code of this script
<head>
<title> Welcome to Profi-One Gym St.Gallen </title>
</head>
<body bgcolor=#000000>
<?php
$benutzer= "ea";
$passwort= "dbuser";
$db = "WM001C2105";
$link = mysql_connect ( "localhost", $benutzer, $passwort ) ;
if ( ! $link )
die ( " Keine Verbindung zum MY SQL Server!" );
mysql_select_db ( $db, $link )
or die ( " Konnte Datenbank \"$db\" nicht öffnen !:
".mysql_error() );
if ( isset ( $Name ) && isset ( $Adresse ) && isset ( $Ort ) && isset ( $phone ) && isset ( $email ) && isset ( $id ) )
{
$anfrage = "DELETE from members Name='$Name', Adresse='$Adresse', Ort='$Ort', phone='$phone' , email='$email' where id=$id";
$ergebnis = mysql_query ( $anfrage ) ;
if ( ! $ergebnis )
die ("Löschen fehlgeschlagen!: ".mysql_error());
print "<font color=#FFFFFF><h1>Tabelle Mitglieder geändert!: ".mysql_affected_rows()."Datensatz gelöscht!</h1></font>";
}
?>
<form action="<? print $PHP_SELF ?>" method="POST">
<?
$ergebnis = mysql_query ( "SELECT Name, Adresse, Ort, phone, email, id from members" );
while( $datensatz = mysql_fetch_object ( $ergebnis ) )
mysql_close ( $link );
?>
<input type="submit" name="Eintrag löschen" value="JA">
<input type="submit" name="Eintrag nicht löschen" value="Nein">
<input type="hidden" name="ID" value="<? echo $id ?>">
</form>
print "<BR>";
print "<font color=#EE82EE><strong><center><a href=http://www.elvisaltherr.com/Start.html>Zurück zur Startseite</font></strong></center>";
</body>