Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][MySQL][PHP] Wyświetlanie tabeli i usuwanie wierszy
skabszo
post 21.08.2015, 20:22:23
Post #1





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 27.08.2004

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


Hej,

mam temat prosty (chyba) ale serio nie potrafię sobie z nim poradzić. Rozwiązania, które tutaj znalazłem na forum po prostu nie działały w przypadku mojego skryptu.. chcę by poza wyświetlaniem tabeli mysql (to działa) była możliwość usuwania wierszy. Oto co już mam:

  1. <?php
  2.  
  3.  
  4. $connection=mysql_connect('localhost','root','') or die(mysql_error());
  5.  
  6.  
  7. mysql_select_db('localhost_paula',$connection) or die(mysql_error());
  8.  
  9. $query=mysql_query("SELECT * FROM cms_contest") or die(mysql_error());
  10.  
  11. if(mysql_num_rows($query)>0):
  12.  
  13. ?>
  14. <form method="post" action="ursite.php">
  15. <table width="100%" border="0" class="mysql-table">
  16. <tr style="font-weight:bold;">
  17. <td align="center" class="heading">Id</td>
  18. <td align="center" class="heading">First Name</td>
  19. <td align="center" class="heading">Last Name</td>
  20. <td align="center" class="heading">Email</td>
  21. <td align="center" class="heading">Phone</td>
  22. <td align="center" class="heading">Answer</td>
  23. <td align="center" class="heading">DEL?</td>
  24. </tr>
  25. <?php
  26.  
  27. while($row=mysql_fetch_object($query)):?>
  28.  
  29. <tr>
  30. <td align="center" class="content"><?php echo $row->ID; //row id ?></td>
  31. <td align="center" class="content"><?php echo $row->name; // row first name ?></td>
  32. <td align="center" class="content"><?php echo $row->surname; //row las tname ?></td>
  33. <td align="center" class="content"><?php echo $row->email; //row created time ?></td>
  34. <td align="center" class="content"><?php echo $row->phone_number; //row created time ?></td>
  35. <td align="center" class="content"><?php echo $row->contest_answer; //row created time ?></td>
  36. <td align="center" class="content"><a href="#">DELETE</a></td>
  37. </tr>
  38. <?php endwhile;?>
  39. </table>
  40. </form>
  41.  
  42. <?php
  43.  
  44. else: ?>
  45. <h3>No Results found.</h3>
  46. <?php endif; ?>


najlepiej jakby to rozwiązanie nie wymagało przechodzenia na inną podstronę (oczywiście może i powinno przeładować stronę obecną..). dzięki za pomoc i wskazówki!
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 02:12