Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z panelem administracyjnym własnej roboty
furman12
post
Post #1





Grupa: Zarejestrowani
Postów: 118
Pomógł: 4
Dołączył: 3.12.2009

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


Mam problem w takim kodzie i nie potrafię go rozwiązać
  1. <?php
  2. include("lib.php");
  3. define("PAGENAME", "Home");
  4. $player = check_user($secret_key, $db);
  5. ?>
  6. <img src="templates/images/header.png">
  7. <div id="menu">
  8. <?php
  9. include("templates/admin_header.php")
  10. ?>
  11. </div>
  12. <table>
  13. <tr>
  14. <th width="30%"><font color="white"><b>Nazwa</b></font></td>
  15. <th width="40%"><font color="white"><b>Opis</b></font></td>
  16. <th width="10%"><font color="white"><b>Typ</b></font></td>
  17. <th width="5%"><font color="white"><b>Efektywność</b></font></td>
  18. <th width="5%"><font color="white"><b>Koszt</b></font></td>
  19. <th width="10%"><font color="white"><b>Akcja</b></font></td>
  20. </tr>
  21. <?php
  22. $query = $db->execute("select `id`, `name`, `description`, `type`, `effectiveness`, `price` from `blueprint_items` order by `type`, `price`");
  23.  
  24. while($item = $query->fetchrow())
  25. {
  26. echo "<tr>";
  27. echo "<td>" . $item['name'] . "</td>\n";
  28. echo "<td>" . $item['description'] . "</td>\n";
  29. echo "<td>" . $item['type'] . "</td>\n";
  30. echo "<td>" . $item['effectiveness'] . "</td>\n";
  31. echo "<td>" . $item['price'] . "</td>\n";
  32. echo "<td><a href=\"admin_items.php?delete=" . $item['id'] . "\">Usuń</a></td>\n";
  33. }
  34.  
  35. if(isset($_GET['delete']) && $_GET['delete']=='' . $item['id'] .'')
  36. {
  37. echo "<td><a href=\"admin_items.php?delete=" . $item['id'] . "\">Usuń</a></td>\n";
  38. }
  39. ?>




PS na razie zamiast usówać chce wyświetlić link

Sorki, zapomniałem napisać, chodzi o to, że nie wyświetla tego usuń po kliknięciu w usuń

Ten post edytował furman12 30.12.2009, 20:15:27
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
Armstrong
post
Post #2





Grupa: Zarejestrowani
Postów: 200
Pomógł: 40
Dołączył: 26.08.2009
Skąd: Kobiernice

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


Cytat(furman12 @ 30.12.2009, 18:08:26 ) *
Mam problem w takim kodzie i nie potrafię go rozwiązać

tu masz problem zmień to: na to: i będzie działać.

Mógłbyś powiedzieć jaki problem?


--------------------
// NOPE
Go to the top of the page
+Quote Post
darko
post
Post #3





Grupa: Zarejestrowani
Postów: 2 885
Pomógł: 463
Dołączył: 3.10.2009
Skąd: Wrocław

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


co pokazują print_r($_GET['delete']); i print_r($item); ?


--------------------
Nie pomagam na pw, tylko forum.
Go to the top of the page
+Quote Post
furman12
post
Post #4





Grupa: Zarejestrowani
Postów: 118
Pomógł: 4
Dołączył: 3.12.2009

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


Nie ma czegoś takiego
Go to the top of the page
+Quote Post
Armstrong
post
Post #5





Grupa: Zarejestrowani
Postów: 200
Pomógł: 40
Dołączył: 26.08.2009
Skąd: Kobiernice

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


  1. if(isset($_GET['delete']) && $_GET['delete']=='' . $item['id'] .'')

Porównujesz, do czegoś czego nie ma

Ten post edytował Armstrong 30.12.2009, 20:27:00


--------------------
// NOPE
Go to the top of the page
+Quote Post
furman12
post
Post #6





Grupa: Zarejestrowani
Postów: 118
Pomógł: 4
Dołączył: 3.12.2009

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


Może sprubójmy jeszcze raz. Mam to i chce żeby po wciśnięciu na usuń usówało mi z bazy wybrany element.
  1. <?php
  2. include("lib.php");
  3. define("PAGENAME", "Home");
  4. $player = check_user($secret_key, $db);
  5. ?>
  6. <img src="templates/images/header.png">
  7. <div id="menu">
  8. <?php
  9. include("templates/admin_header.php")
  10. ?>
  11. </div>
  12. <table>
  13. <tr>
  14. <th width="30%"><font color="white"><b>Nazwa</b></font></td>
  15. <th width="40%"><font color="white"><b>Opis</b></font></td>
  16. <th width="10%"><font color="white"><b>Typ</b></font></td>
  17. <th width="5%"><font color="white"><b>Efektywność</b></font></td>
  18. <th width="5%"><font color="white"><b>Koszt</b></font></td>
  19. <th width="10%"><font color="white"><b>Akcja</b></font></td>
  20. </tr>
  21. <?php
  22. $query = $db->execute("select `id`, `name`, `description`, `type`, `effectiveness`, `price` from `blueprint_items` order by `type`, `price`");
  23.  
  24. while($item = $query->fetchrow())
  25. {
  26. echo "<tr>";
  27. echo "<td>" . $item['name'] . "</td>\n";
  28. echo "<td>" . $item['description'] . "</td>\n";
  29. echo "<td>" . $item['type'] . "</td>\n";
  30. echo "<td>" . $item['effectiveness'] . "</td>\n";
  31. echo "<td>" . $item['price'] . "</td>\n";
  32. echo "<td><a href=\"admin_items.php?delete=" . $item['id'] . "\">Usuń</a></td>\n";
  33. }
  34. ?>

Go to the top of the page
+Quote Post
darko
post
Post #7





Grupa: Zarejestrowani
Postów: 2 885
Pomógł: 463
Dołączył: 3.10.2009
Skąd: Wrocław

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


  1. if(is_numeric($_GET["delete"]) && $_GET["delete"] > 0) {
  2. $q = "delete from blueprint_items where id=".$_GET["delete"];
  3. $result = $db->execute($q);
  4. if(!$result) {
  5. }
  6. else {
  7. echo "usunięto";
  8. }
  9. }


--------------------
Nie pomagam na pw, tylko forum.
Go to the top of the page
+Quote Post

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: 20.08.2025 - 20:19