I could really use some help with this, I've looked for a long time for a solution.
I have a function which connects to my database, I keep it in a separate file with the rest of my functions.
Code: Select all
function spanDataConnect ($database){
$con = mysql_connect("localhost","user","password");
if (!$con){die('Could not connect: ' . mysql_error());}
mysql_select_db($database, $con);
return($con);
}Code: Select all
$con = spanDataConnect('database');
echo "Connection = ".$con;
$query = sprintf('select size, type, message, filename from letters where message_ID = %d', $id);
$result = mysql_query($query, $con);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
$image = mysql_fetch_array($result);
header('Content-type: ' . $image['type']);
header('Content-length: ' . $image['size']);
echo $image['message'];Code: Select all
error_reporting(E_ALL)Any ideas on why this may be happening?
Cheers
Tee