![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 29 Pomógł: 0 Dołączył: 31.01.2005 Skąd: stąd :) Ostrzeżenie: (0%) ![]() ![]() |
Mam taką małą bazę dla celów ćwiczebnych (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) ale niestety cos mi nie działa przy usuwaniu rekordów. Wyświetla się taki komunikat:
--------------------------------------- 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? (IMG:http://forum.php.pl/style_emoticons/default/blink.gif) --------------------------------------- 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>' ; ?> |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 29 Pomógł: 0 Dołączył: 31.01.2005 Skąd: stąd :) Ostrzeżenie: (0%) ![]() ![]() |
Dzięki wszystkim za pomoc.
Ale nadal pozostał problem tego usuwania z bazy. (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) Kod niby powinien działać, a jednak wyskakuje taki błąd: Cytat Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. A w logu błędów: Cytat [Sat Feb 05 21:19:48 2005] [error] [client 127.0.0.1] Premature end of script headers: c:/apache/php/php.exe Mam PHPTriad. Wie ktoś może jak powinienem zmienić konfigurację programu aby mySQL działało mi poprawnie?(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) |
|
|
![]() ![]() |
![]() |
Aktualny czas: 10.10.2025 - 21:23 |