Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] header('location: '); Nie działa
oz3h
post
Post #1





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 3.12.2006

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


Mam taki kod:
  1. <?php
  2. if (isset($_GET['download'])) {
  3. header('location: '.$result['file_link']);
  4. }
  5. ?>


Gdy włączam stronę wyskakuje mi taki błąd: Warning: Cannot modify header information - headers already sent by (output started at c:\usr\krasnal\www\oz3h\file.php:7) in c:\usr\krasnal\www\oz3h\file.php on line 36

Nie wiem o co chodzi, szukałem już o tym na forum lecz nic nie znalazłem co mogło by mi pomóc (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)

Ten post edytował oz3h 5.12.2006, 22:16:28
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
oz3h
post
Post #2





Grupa: Zarejestrowani
Postów: 16
Pomógł: 0
Dołączył: 3.12.2006

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


Mam takie coś:
  1. <?php
  2. require_once('globals.php');
  3.  
  4. $query = mysql_query ("SELECT * FROM files WHERE file_id =".$_GET['id']." ORDER BY file_id DESC");
  5. if ($result = mysql_fetch_assoc ($query)) {
  6. $id = (int)$_GET['id'];
  7. $file_id = $result['file_id'];
  8. $file_name = $result['file_name'];
  9. $file_description = $result['file_description'];
  10. $file_description2 = $result['file_description2'];
  11. $file_size = $result['file_size'];
  12. $file_licence = $result['file_licence'];
  13. $file_os = $result['file_os'];
  14. $file_producer = $result['file_producer'];
  15. $file_producer_link = $result['file_producer_link'];
  16. $file_lang = $result['file_lang'];
  17. $file_link = $result['file_link'];
  18. $file_screen = $result['file_screen'];
  19. $file_screen_width = $result['file_screen_width'];
  20. $file_screen_height = $result['file_screen_height'];
  21. $file_date = $result['file_date'];
  22. $file_downloads = $result['file_downloads'];
  23. $download = 'file.php?id='.$file_id.'&download=ok';
  24.  
  25. if (isset($_GET['download'])) {
  26. mysql_query ("UPDATE files SET file_downloads=file_downloads+1 WHERE file_id=$id");
  27. header('location: '.$result['file_link']);
  28. }
  29. ?>


Ten Twój sposób z Javą działa lecz wolał bym zrobić to z header (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)

Cytat(skowron-line @ 5.12.2006, 22:32:40 ) *
na poczatku skryptu w 1 lini wpisz

ob_start();

i bedzie po temacie


Już tego próbowałem wcześniej i też nie działało.
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: 3.10.2025 - 12:08