Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> blad w skladni sql?
-kase-
post
Post #1





Goście







Witam mam pewien problem. Mam panel administracyjny a w nim rekordy z loginami do strony. Na samym jest form do usuwania rekordow. Niestety skrypt usuwania nie dziala jak powinien:( . Najpierw wyszukuje czy istnieje wpisana nazwa, jesli istnieje usuwa ja, jesli nie informuje ze podany profil nie istnieje... Niestety caly czas informuje ze profil nie istnieje mimo ze znajduje sie nawet takowy w bazie..

  1. <?php
  2. include "connect.php";
  3.  
  4. if (($_POST['type_d'])=="admin_d"){
  5.  
  6. $find=("SELECT username FROM admin WHERE 
  7. MATCH (username) AGAINST ('".$_POST['deluser']."')");
  8. $res= mysql_query($find) or die (mysql_error());
  9.  
  10. if ($res and !mysql_num_rows($res)){
  11. echo "Podany profil nie istnieje!";
  12. }
  13. else{
  14.  $usun=("DELETE FROM admin WHERE 
  15. username='".$_POST['deluser']."' LIMIT 1");
  16. $res=mysql_query($usun) or die (mysql_error());
  17. include "deleted.php";
  18. }
  19. }
  20.  
  21. else if (($_POST['type_d'])=="user_d"){
  22.  
  23. $find=("SELECT username FROM user WHERE 
  24. MATCH (username) AGAINST ('".$_POST['deluser']."')");
  25. $res=mysql_query($find) or die (mysql_error());
  26.  
  27. if ($res and !mysql_num_rows($res)){
  28. echo "Podany profil nie istnieje!";
  29. }
  30. else{
  31.  $usun=("DELETE FROM user WHERE 
  32. username='".$_POST['deluser']."' LIMIT 1") ;
  33. $res=mysql_query($usun) or die (mysql_error());
  34. include "deleted.php";
  35. }
  36. }
  37.  
  38. ?>
Go to the top of the page
+Quote Post

Posty w temacie
- kase   blad w skladni sql?   14.01.2008, 18:09:41
- - Maxik   [PHP] pobierz, plaintext <?php$query = mysql_qu...   14.01.2008, 18:17:19
- - Gość   Ok zrobilem to przy uzyciu operatora LIKE i wszyst...   14.01.2008, 18:19:59


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: 23.08.2025 - 01:37