Hi Mate,
ive got a big problem I coded I think a good script to store images in the Database but I cant read them out of the database !! Is it because of the Storing Script or is it because of the Reading from Database Script The first Script Ill show you is the Inserting in Database Script its the follow one:
<?php
if($submit)
{
$db = mysql_connect();
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
$sqlab = "insert binary_data";
$sqlab .= "(description,bin_data,filename,";
$sqlab .= " filesize, filetype) values ";
$sqlab .= "('$form_description', '$data', '$form_data_name', '$form_data_size', '$form_data_type')";
mysql_db_query("Bilder", $sqlab);
$id = mysql_insert_id();
$num = mysql_affected_rows();
if ($num>0)
echo "text<p>";
else
{
echo "text";
echo "text<p>";
}
mysql_close($db);
}
?>
And the following Script is the one to get the image out of the db into my browser :
<?php
if($Ok) {
@MYSQL_CONNECT();
@mysql_select_db("binary_data");
$query = "select bin_data,filetype from binary_data where id = $id";
$result = @($query);
$data = addslashes(fread(fopen($form_data, "o"), filesize($form_data)));
$data = @MYSQL_RESULT($result,0,"bin_data");
$type = @MYSQL_RESULT($result,0,"filetype");
Header("Content-type:$type");echo $data;
};
?>
It would be really really great if there is someone outta who could help me !!