Hi guys,
Ive started creating my own photo gallery
Got a table which hold the gallery folder name, description and a photo (to be shown as the folders front cover)
Ive coded to show all the folders in the table, but having problems showing the photos.....
Ive previously used the following to show a single photo from the db:
// Connect to the database
mysql_connect("localhost", "root", "") or die("Could not connect : " . mysql_error());
mysql_select_db("advertising") or die("Could not select database");
//Select the image data from the website table
$query = "select bin_data, image_type from websites where ID=$id";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"bin_data");
$type = @MYSQL_RESULT($result,0,"image_type");
//Determine the type of file
Header( "Content-type: $type");
//Echo the image file
echo $data;
}
To use it for all data Ive put:
//Create a new row for each match
while($row=mysql_fetch_array($q)) {
echo('<tr>');
echo("<td COLSPAN=3 ALIGN=center><A HREF='folder.php'>");
if ($row["bin_data"]) {
//Select the image data from the website table
$query = "select bin_data, image_type from gallery_folder where galleryID=".$row['galleryID']."";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"bin_data");
$type = @MYSQL_RESULT($result,0,"image_type");
//Determine the type of file
Header( "Content-type: $type");
echo $data;
}
echo ("</A></td>");
echo("<td COLSPAN=3 ALIGN=center><I><DIV CLASS=mainText>". $row["title"] ."</DIV></I></td>");
);
But everytime I get the error:
Warning: Cannot modify header information - headers already sent by (output started at C:\apachefriends\xampp\htdocs\travel site\gallery.php:160) in C:\apachefriends\xampp\htdocs\travel site\gallery.php on line 199
Line 160 is: echo '<DIV CLASS="mainText">The current folders:</DIV>';
Line 199 is: Header( "Content-type: $type");
So obv doesnt like the Header part, which im not sure whats wrong....am using a session code to maintain the user id whilst they are on the site which is the only thing i can think:
// start the session
session_start();
header("Cache-control: private"); //IE 6 Fix
Any help would be great!
Cheers,
Spoons