Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wyświetlanie zdjęć z bazy danych, Cannot modify header information - headers already sent by
seba15290
post
Post #1





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 6.06.2007

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


Witam, mam skrypt, w którym pobieram z tabeli people opis i z tabeli zdjecie zdjęcie do opisu. Gdy wyswietlam skrypt na stronie wyrzuca mi : Warning: Cannot modify header information - headers already sent by (output started at /var/www/get_img.php:10).
Oto ten srypt:
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3.  
  4. <head>
  5. <title>Biogram</title>
  6. <meta name="GENERATOR" content="Quanta Plus">
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  8. </head>
  9. <body>
  10.  
  11. <?php
  12.  
  13. if (isset($_GET['id_cat']))
  14.  
  15. {
  16. $id_people=$_GET['id_cat'];
  17.  
  18.  
  19. {
  20. $id_people=addslashes($id_people);
  21. }
  22.  
  23. include ('./mysql_connect.php');
  24.  
  25. $zapytanie = "select * from people as p LEFT JOIN zdjecie as z ON p.id_zdjecia=z.id_zdjec
    ia WHERE p.id_people='$id_people';"
    ;
  26.  
  27. if (!mysql_query($zapytanie))
  28. print "Nie udało sie odczytac danych z tabeli"; 
  29.  
  30. $wynik = mysql_query($zapytanie)
  31. or die('Błąd zapytania'); 
  32.  
  33.  echo "<table cellpadding=\"5\" border=0>";
  34. while($r = mysql_fetch_array($wynik)) {
  35.  
  36. $cat=$r['id_people'];
  37.  echo "<tr>";
  38. echo "<td align=\"center\">".$r['imie'],' ', $r['nazwisko']."</td>";
  39. echo "</tr><tr>";
  40. echo "<td>".$r['opis']."</td>";
  41. echo "<td><a href=\"update.php?id_cat={$cat}\">Edytuj</a></td>";
  42. echo "</tr>";
  43.  
  44. $filename=$r['nazwa_pliku'];
  45. $mimetype=$r['typmime'];
  46. $filedata=$r['dane_pliku'];
  47.  
  48. header("content-disposition: inline; filename=$filename");
  49. header("content-type: $mimetype");
  50. header('content-length: ' .strlen($filedata));
  51.  
  52. echo $filedata;
  53.  
  54. }
  55. echo "</table>";
  56. }
  57. else
  58. {
  59. echo "Nie podano zmiennej";
  60.  
  61. }
  62. ?>
  63.  
  64. </body>
  65. </html>


zmienna $filedata przechowuje zdjęcie

Ten post edytował seba15290 16.10.2007, 16:30:49
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: 5.01.2026 - 10:37