Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> usuwanie rekordu z bazy, nie moge usunac rekordu z bazy danych
dekrzycho
post
Post #1





Grupa: Zarejestrowani
Postów: 39
Pomógł: 0
Dołączył: 10.01.2005

Ostrzeżenie: (10%)
X----


witam. mozecie mi pomoc poniewaz nie moge usunac rekordu z bazy jesli spelniony jest warunek. oto kod jaki napisalem

Kod
if ($letter!="on")  
  {
     // Check for valid user
     $duplicate = @mysql_query("select count(*) no_of_records from newsletter where email1='$email1'");

     if (!$duplicate)
    {
        echo("Error performing query: " . mysql_error());
    }

     $row_duplicate = mysql_fetch_array($duplicate);

     if (($row_duplicate['no_of_records']) == "0")
     {
      // usuwanie rekordu
          $usun = "delete from newsletter where
                   email1='$email1'";
            //   mysql_query($sql);  
    
      if (@mysql_query($usun))
      {
        // echo("Thank you for registering");
        // echo($pageid);
        // echo($title);
        echo ("<meta http-equiv=refresh content=0;url=index.php>");
      }
      else
      {
          //echo ("This email address is already present in our database. Please check you entered the correct address. If you have, you may have already registered and do not need to register again.");
          echo ("<meta http-equiv=refresh content=0;url=index.php>");
          exit();
      }
     }
     //else
     //{
     //    echo ("Error registering user: " . mysql-error());
        //}

   }
Możecie rzucić okiem i określić co robie żle, może jakieś poprawki...
wielkie dzięki z gory
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Kinool
post
Post #2





Grupa: Zarejestrowani
Postów: 560
Pomógł: 0
Dołączył: 15.07.2003
Skąd: Kwidzyn

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


pytanie usuwajace jest raczej ok przyczyna moze byc regiser_global uzywaj tablic globanych $_POST, $_GET itp.

dawaj tez w kazdem warunku kelementy kontrolne np. echo 'Warunek 1 ok'; itp. i bedziesz wiedzial jakie warunki sa spelniane a jakie nie co naprowadzi cie gdzie moze twkic ew. blad (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
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: 10.10.2025 - 09:17