Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Nie moge wymyślić, jak usunąc wiersz z, tabeli w bazie danych
miedzna
post
Post #1





Grupa: Zarejestrowani
Postów: 401
Pomógł: 1
Dołączył: 10.03.2004
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Mam taki kod:

usun_newsa.php
  1. Uporządkuj wiadomości według: <a href=\"usun_newsa.php?orderby=date\">dat</a>, <a href=\"usun_newsa.php?orderby=news_id\">id</a>, <a href=\"usun_newsa.php?orderby=heading\">nagłówków</a> lub <a href=\"usun_newsa.php?orderby=author\">autorów</a>.<BR><BR>
  2.  
  3.  
  4.  
  5. <TABLE BORDERcolor=\"#000000\" border=\"1\" CELLSPACING=0 CELLPADDING=2 WIDTH=\"450\" class=\"ramka\">
  6.  
  7. <?php
  8. $db = mysql_connect (&#092;"localhost\", \"\", \"\");
  9. mysql_select_db (&#092;"roznosci\", $db);
  10. if ($orderby == 'date'):
  11.     $sql = &#092;"select * from news order by 'date'\";
  12. elseif ($orderby == 'news_id'):
  13.     $sql = &#092;"select * from news order by 'news_id'\";
  14. elseif ($orderby == 'author'):
  15.     $sql = &#092;"select * from news order by 'author_name'\";
  16. elseif ($orderby == 'heading'):
  17.     $sql = &#092;"select * from news order by 'heading'\";
  18. endif;
  19. else:
  20.     $sql = &#092;"select * from news order by 'news_id'\";
  21. endif;
  22. $result = mysql_query($sql);
  23. while ($row = mysql_fetch_array ($result)) {
  24.     print(&#092;"<tr><td bgcolor=\"#E1E1FF\" class='tytul'>\");
  25.     printf(&#092;"<font color='red'>%s</font>&nbsp;-&nbsp;%s</td></tr>n\", $row[\"news_id\"], $row[\"heading\"]);
  26.     printf(&#092;"<td><span class='autor'>Autor: <a href=\"mailto:%s\">%s</a></span>n\", $row[\"author_email\"], $row[\"author_name\"]);
  27.     printf(&#092;"<br><span class='data'>Nadesłano: <I>%s</I></span><BR>n\", $row[\"date\"]);
  28.     printf(&#092;"</td></tr>n\");
  29. }
  30. ?>
  31.  
  32. </table>



problem jest taki, że nie wiem w jaki sposób można przy każdym tytule newsa umieścić button USUŃ Newsa i po kliknięciu na ten przycisk usuwało by nam dokładnie ten news, przy którym jest przycisk.

DZieki za pomoc...

Ten post edytował miedzna 14.10.2004, 09:42:37
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 20:02