Skip to main content
Participant
May 3, 2011
Question

How to display a .txt file stored in DataBase

  • May 3, 2011
  • 1 reply
  • 476 views

Hi,

I'm using Dreamweaver (PHP/MySQL) using Xampp as a server, on a mac plateforme : Intel - Snow leopard 10.6.7.

I made up a database using phpMyadmin : It looks like this :

Artistes names          @7544060                              Biographies

artiste 1                    images/picture1.jpg               1- Lorem ipsum dolor sit amet........

artiste 2                    images/picture2.jpg                2- Lorem ipsum dolor sit amet........

and so on....

Now Calling the Database & using the Bindings, I get everything working fine!

My Question is :

I want to use text file in the Biographies field : so instead of inserting the text directly in my database, I would like to use .txt files.

My database will look like this :

Artistes names          @7544060                              Biographies

artiste 1                    images/picture1.jpg               file1.txt

artiste 2                    images/picture2.jpg               file2.txt

and so on...

How to make the textes inside the .txt files, show up in my page, as the pictures do!, and do I have to add the "@" before "Biographies" as with "@pictures".

Any Help Please?

Thank U.

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Community Expert
May 4, 2011

Depending on the length of the files you could use file_get_contents to print the string.  Or you can use the fopen, fread, fclose commands.  Links are below.  How much data are we talking about and is there HTML that needs to be parsed in the text file or is it all plain text?

http://www.php.net/manual/en/function.file-get-contents.php

http://www.php.net/manual/en/function.fread.php