Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Usunięcie rekordu
--Tomick--
post
Post #1





Goście







Gdzie tkwi błąd:

  1. <form action="usun.php" method="post" enctype="multipart/form-data">
  2. <input class="none" name="autor" value="'.$user_data['user_name'].'" >
  3. <input class="none" name="id" value="'.$row[0].'">
  4. <input type="submit" value="- Usuń" class="button"></form>


usun.php

  1. <?php
  2. include("connect.php");
  3.  
  4. if($_SERVER['REQUEST_METHOD'] == 'POST')
  5. {
  6. $query = "DELETE from tresc WHERE autor = '".$_POST['autor']."' AND id = '".$_POST['id']."'";
  7. }
  8. header ("Location: tresc.php");
  9. ?>


W ogóle mi nie usuwa rekordow z bazy
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
miniol
post
Post #2





Grupa: Zarejestrowani
Postów: 84
Pomógł: 4
Dołączył: 25.03.2011

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


A gdzie tu zapytanie? Ja widzę samego stringa.

Zamiast:
  1. $query = "DELETE from tresc WHERE autor = '".$_POST['autor']."' AND id = '".$_POST['id']."'";


Powinno być:
  1. $query = mysql_query("DELETE from tresc WHERE autor = '".$_POST['autor']."' AND id = '".$_POST['id']."';");


Ten post edytował miniol 24.07.2012, 12:13:22
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: 5.10.2025 - 06:15