Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MYSQL]Nie dodaje danych do bazy
grzeg123
post 17.03.2009, 15:52:33
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 27.05.2007

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


witam!

Jak w temacie^

wpisuje dane do formularza wyświetla się napis że news został dodany (15 linijka) więc musiało prześć przez funkcje insert. Sprawdzam w bazie danych licze rekordów i nic.

  1. <? include('..config.conf');
  2. switch($_GET['send'])
  3. {
  4. case 'ok';
  5. if(isset($_POST['temat']) && $_POST['temat']=='') $blad = 'Wypełnij pole tematu!</br>';
  6. if(isset($_POST['tresc']) && $_POST['tresc']=='') $blad = 'Wypełnij pole treści!';
  7. if(!isset($blad))
  8. {
  9. $tresc = $_POST['tresc'];
  10. $temat = $_POST['temat'];
  11. $id = "SELECT MAX('id') FROM news";
  12. $data = "date(d M Y G:i:s)";
  13. $zapytanie = "INSERT INTO news SET id='$id', temat='$temat', tresc='$tresc', data='$data', autor='$login' ";
  14. $idzapytania = mysql_query($zapytanie);
  15. echo '<p class="accept"><b>News został zamieszczony!</b></p> ';
  16. }
  17. }
  18. ?>
  19. <html>
  20. <head>
  21. <meta http-equiv="Content-Language" content="pl">
  22. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
  23. <title>Dodawanie Newsa</title>
  24. </head>
  25.  
  26. <body>
  27. <form method="POST" action="news.php?send=ok">
  28. <table cellpadding="0" cellspacing="0" width="532" height="495">
  29.    <!-- MSTableType="layout" -->
  30.    <tr>
  31.        <td height="24" valign="top">Dodawanie Newsa:</td>
  32.    </tr>
  33.    <tr>
  34.        <td height="26" valign="top"><div class="error"><? echo $blad; ?></div></td>
  35.    </tr>
  36.    <tr>
  37.        <td height="26" valign="top">Temat:
  38.        <input type="text" name="temat" size="88" class="input">
  39.                        
  40.        </form>
  41.        </td>
  42.    </tr>
  43.    <tr>
  44.        <td height="419" width="532">
  45.        <p>
  46.        <textarea rows="23" name="tresc" cols="63"></textarea></p>
  47.        <p><input type="submit" value="Dodaj" name="B1" class="przycisk"><input type="reset" value="Kasuj" name="B2" class="przycisk"></p></td>
  48.    </tr>
  49. </table>
  50.  
  51. </body>
  52. </html>


Ten post edytował grzeg123 17.03.2009, 16:09:11
Go to the top of the page
+Quote Post

Posty w temacie


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: 13.06.2025 - 23:31