Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] session_start() - błąd
Forum PHP.pl > Forum > Przedszkole
Ramzaa
Witam, mam problem z sesją. Najlepiej to kod przedstawi:

  1. <?php
  2.  
  3. include ('baza.php');
  4.  
  5. switch($_GET['option'])
  6. {
  7.  
  8. case "result":
  9.  
  10. $user_login = htmlspecialchars(trim(mysql_real_escape_string($_POST['user_login'])));
  11. $user_password = htmlspecialchars(trim(mysql_real_escape_string($_POST['user_password'])));
  12. $error1 = "<a href=\"index.php?action=register\">Powrót</a><br /><br />";
  13.  
  14. $zapytanie_user = "SELECT `name`, `password` FROM `uzytkownicy` WHERE name = '$user_login' AND password = '$user_password'";
  15.  
  16. $wykonaj = mysql_query($zapytanie_user);
  17.  
  18. if(@mysql_num_rows($wykonaj))
  19. {
  20.  
  21. echo ("DOBRZE JEST!");
  22.  
  23. }
  24.  
  25. else
  26. {
  27. echo ("$error1 Podane dane są błędne!");
  28. }
  29.  
  30. break;
  31. default;
  32.  
  33.  
  34. ?>
  35.  
  36. <form action="index.php?action=logowanie&option=result" method="POST">
  37.  
  38. <table border="0" width="100%">
  39.  
  40. <tr>
  41. <td width="12%">Login:</td>
  42. <td wdith="88%"><input type="text" size="20" maxlength="20" name="user_login"></td>
  43. </tr>
  44.  
  45. <tr>
  46. <td>Hasło:</td>
  47. <td><input type="password" size="16" maxlength="16" name="user_password"></td>
  48.  
  49. </tr>
  50.  
  51. </table><br /><br />
  52.  
  53. <input type="submit" value="Logowanie">
  54.  
  55. </form>
  56.  
  57. <?php
  58.  
  59. }
  60.  
  61. ?>


Wyskakuje błąd:

Cytat
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\xampp\htdocs\forum\baza.php:17) in C:\xampp\xampp\htdocs\forum\logowanie.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\xampp\htdocs\forum\baza.php:17) in C:\xampp\xampp\htdocs\forum\logowanie.php on line 2


Co może być przyczyną?
Aha, próbowałem oczywiście z ob_start(), ale to nic nie daje, dlatego założyłem wątek.
Spawnm
Na temat 'headers already sent by ' było już wiele tematów, poszukaj odpowiedzi.
Zamykam.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.