
---------------------------------------
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
--------------------------------------------------------------------------------
Apache/1.3.23 Server at localhost Port 80
---------------------------------------
Na dodatek jeśli dodam nową osobę do bazy, to po odświeżeniu strony ten sam rekord dodaje się po raz drugi, po następnym odświeżeniu jeszcze raz i tak w kółko - jak temu zapobiec?

---------------------------------------
Oto kod:
<?php
mysql_connect( "localhost", "root", "")
or die( "nie mozna sie polaczyc z mysql.");
mysql_select_db( "bazaa" )
or die( "nie mozna wybrac bazy.");
if( $co == 'dodaj' )
{
if( $imie && $nazwisko && $telefon )
{
$query = "INSERT INTO book (nr, imie, nazwisko, telefon) " ;
$query .= "VALUES ('', '$imie', '$nazwisko', '$telefon');" ;
$baz = mysql_query( $query );
/* $baz= mysql_query( "INSERT INTO book (nr, imie, nazwisko, telefon) VALUES ('', '$imie', '$nazwisko', '$telefon');" );*/
}
}
elseif( $co == 'skasuj') {
$baz = mysql_query
("DELETE FROM book WHERE nr='$id' LIMIT 1;")
or die("blad w kasowaniu");
}
$baz = mysql_query("SELECT * FROM book;")
or die("blad w zapytaniu.");
print( "<table border=0 cellpadding=5 cellspacing=2 bgcolor=teal>");
print( "<tr><td><b>imie</b></td><td><b>nazwisko</b></td>");
print( "<td><b>telefon</b></td></tr>\n");
while( $rekord = mysql_fetch_array( $baz ))
{
$id = $rekord[0];
print( "<tr><td>$rekord[1]</td><td>$rekord[2]</td><td>$rekord[3]</td>");
print( "<td><a href=\"book.php?co=skasuj&id=$id\">skasuj</a></td></tr>\n" );
}
print "</table>" ;
print '<form method="get">Nowy rekord:' ;
print '<input type="hidden" name="co" value="dodaj"><table>' ;
print '<tr><td>imie:</td><td><input type="text" name="imie"></td></tr>' ;
print '<tr><td>nazwisko:</td><td><input type="text" name="nazwisko"></td></tr>' ;
print '<tr><td>telefon:</td><td><input type="text" name="telefon"></td></tr></table>' ;
print '<input type="submit" value="dodaj"></form>' ;
?>