Is there a way I can display an image, pdf or word doc that is stored in a my sql database?
I tried to pull up a word doc with this:

$sql = " SELECT * FROM user WHERE username = '$_SESSION[MM_Username]' ";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result)) {
$inv=$row['invoice'];}
 ?>
 <?php echo " Your Invoice: ".$inv." ";
?>

But all I got was code from the document.

Member Avatar for diafol

I take it that your invoice field just contains the file's url and not the file itself.

$inv = $row['invoice'];
$base = basename($inv); //you don't want to display the full path in the link label

...in loop...
echo "<a href=\"$inv\" title=\"\">$base</a>";

No it is the file itself. Not a good idea?
My goal is to have it so the site owner can upload an invoice for a specific user. Then when that user loggs in, they will only be able to view their invoice or whatever via the session.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.