| | |
Displaying files from database
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2009
Posts: 25
Reputation:
Solved Threads: 0
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:
But all I got was code from the document.
I tried to pull up a word doc with this:
PHP Syntax (Toggle Plain Text)
$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.
Last edited by Ezzaral; 31 Days Ago at 1:06 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
-1
#2 31 Days Ago
I take it that your invoice field just contains the file's url and not the file itself.
PHP Syntax (Toggle Plain Text)
$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>";
Last edited by ardav; 31 Days Ago at 12:21 pm.
Dunna letta dem afool ya - duh reppa sistema is da evil. INDETERMINACY is alive anda wella - force a duh issue.
![]() |
Similar Threads
- need good script for uploading and displaying all images from database (PHP)
- displaying image from database (PHP)
- Can anyone tell me how to connect VB6 files with database?? (Visual Basic 4 / 5 / 6)
- store files in database (ASP.NET)
- Upload files into database (JSP)
- Storing files in database (C#)
- Displaying Images( buffered data ) from the Database using Java (Java)
Other Threads in the PHP Forum
- Previous Thread: php code error
- Next Thread: mySQL TABLES
| Thread Tools | Search this Thread |
# 5.2.10 ajax apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date display dissertation dynamic echo echo$_get[x]changingitintovariable... email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link local login loop mail memberships menu mlm multiple multipletables mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote rss script search server sessions sms soap sockets source space spam sql syntax system table tutorial update upload url validator variable video web xml youtube






