Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL][PHP]nie zapisuje !
bartek4175
post 17.08.2013, 08:28:20
Post #1





Grupa: Zarejestrowani
Postów: 284
Pomógł: 1
Dołączył: 15.08.2013

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


Mam błąd nie zapisuje do bazy danych!!!


Oto Kod:

  1. <?php
  2. require_once ('szkielet.php');
  3. ?>
  4. <center>
  5. <?
  6. $user = user::getData('', '');
  7. $errors = '';
  8. //formularz
  9. ?>
  10. <form method="post" action="">
  11. <input type="hidden" name="od" value="'.$user['login'].'" />
  12.  
  13.  
  14. <label for="pass">Do kogo wyslac wiadomosc:</label>
  15. <input maxlength="32" type="text" name="do" id="do" />
  16.  
  17. <label for="pass_again">Temat:</label>
  18. <input maxlength="32" type="text" name="tytul" id="tytul" />
  19.  
  20. <label for="email">Tresc:</label>
  21. <textarea name="wiadomosc" cols="17" rows="6"></textarea><br>
  22.  
  23.  
  24. <input type="hidden" name="stan" value="nie_odebrany" />
  25. <input type="hidden" name="send" value="1" />
  26. <input type="submit" value="Wyslij" />
  27.  
  28.  
  29.  
  30. </form>
  31. </center>
  32. <?php
  33. if ($_POST['send'] == 1) {
  34. $temat = mysql_real_escape_string(htmlspecialchars($_POST['tytul']));
  35. $tresc = mysql_real_escape_string(htmlspecialchars($_POST['wiadomosc']));
  36. $stan = mysql_real_escape_string(htmlspecialchars($_POST['stan']));
  37.  
  38. if ($errors != '') {
  39. echo '<center><font color="red"> Wystapil Blad!</font></center>';
  40.  
  41. }
  42. else{
  43. mysql_query("INSERT INTO wiadomosci (od, do, tytul, wiadomosc, stan) VALUES('$od','$do','$temat', '$tresc', '$stan');") or die('BŁĄD:'.mysql_error());
  44. echo '<center><font color="green">Wiadomosc wyslana poprawnie!</font></center>';
  45. }
  46. }
  47.  
  48.  
  49. require_once ('stopka.php');


Nic nie wyświetla - żadnego błędu ale do bazy nie dodaje !

Proszę o pomoc!
Go to the top of the page
+Quote Post
Mackos
post 17.08.2013, 09:21:44
Post #2





Grupa: Zarejestrowani
Postów: 362
Pomógł: 44
Dołączył: 10.06.2009

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


Hmm... no może dlatego że cały czas wykonuje się to co jest w ifie:
  1. if ($_POST['send'] == 1)

A nie w else.


--------------------
WebLemon.pl - projektowanie stron www, reklama i PR w internecie - Adwords, Facebook.
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 Wersja Lo-Fi Aktualny czas: 14.08.2025 - 11:33