I am running this code in php4 localy on my pc and it works fine. When i upload it on the server (using PHP5) the bin_data (field that holds the photo) is not displayed.
if($id) {
$query = "select bin_data, filetype from table_article where id=1";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"bin_data");
$type = @MYSQL_RESULT($result,0,"filetype");
//$description = @MYSQL_RESULT($result,0,"description");
Header( "Content-type: $type");
echo $data;
}
the table i have created is the following (it has only one record with id=1):
CREATE TABLE table_article (
id int(4) NOT NULL default '0',
article longtext,
article2 longtext,
article3 longtext,
filename varchar(50) default NULL,
filesize varchar(50) default NULL,
filetype varchar(50) default NULL,
bin_data longblob,
photo2 longblob,
photo3 longblob,
PRIMARY KEY (id)
) TYPE=MyISAM;
Also another problem is that when i try to upload a photo (using PHPmyAdmin interface) in photo2 and photo3 fields i get a NULL field after the uploads. The bin_data field works fine but the photo can not be displayed after all. Could this be something related to the problem i have above?
I have tried all kinds of possible different codes and i still haven't figure this out.
Please somebody help.