Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Aktualizacja rekordów php , mysql
swajt
post
Post #1





Grupa: Zarejestrowani
Postów: 89
Pomógł: 0
Dołączył: 24.01.2014

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


Witam pomoże mi ktoś z kodem do aktualizacji rekordu bo sobie nie moge gdzieś dać rady : (

Oto kod php -

  1. <table class="table table-striped table-bordered">
  2. <tr>
  3. <td>#</td>
  4. <td>Tytuł</td>
  5. <td>Treść</td>
  6. <td>Autor</td>
  7. <td>Akcja</td>
  8. </tr>
  9.  
  10.  
  11. <?php
  12. if(isset($_GET['usun']))
  13. {
  14. echo '<div class="alert alert-success" role="alert">Poprawnie usunięto newsa!</div>';
  15. $id = $_GET['usun'];
  16. $sql = "DELETE FROM `news` WHERE `id` = '$id' LIMIT 1";
  17. $db -> query($sql);
  18. }
  19.  
  20. $sqll = "SELECT * FROM news ORDER BY id ASC";
  21. $wynik = $db -> query($sqll);
  22. $x = 1;
  23. while($r = $wynik->fetch()) {
  24. $wlasnosc = $userdata['user_login'];
  25. if($r['autor'] == $wlasnosc){
  26. echo '<tr>
  27. <td>'.$x.'</td>
  28. <td>'.$r['tytul'].'</td>
  29. <td>'.$r['tresc'].'</td>
  30. <td>'.$r['autor'].', '.$r['data'].'</td>
  31. <td><a href="delete-news&usun='.$r['id'].'">Usuń</a> | <a href="#">Edytuj</a></td>
  32. </tr>';
  33. $x++;
  34. }
  35. }
  36.  
  37. ?>
  38. </table>
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 Aktualny czas: 21.08.2025 - 03:34