| | |
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; 30 Days Ago at 1:06 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
-1
#2 30 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; 30 Days Ago at 12:21 pm.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
All opinions count - unless you're a serial downvoter.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
![]() |
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 |
ajax apache api array arrays beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external file files folder form forms forum function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail malfunction menu method mlm multiple mysql neutrality oop paypal pdf php phpmysql play problem query question radio random recursion regex remote root script search select server sessions sms soap source space sql syntax system table tutorial update upload url validator variable video web xml youtube






