Storing and displaying PDF in MySQL and PHP
Storing and displaying PDF in MySQL and PHP
am 31.03.2008 16:16:51 von Merou63
Hello, everybody!
Here's what I want to achieve:
In a table of a DB mysql, I would have 2 fields: a text box (a title) and a
field capable of storing the contents of a pdf.
I want to add (delete, modify) records. When I add a new record, I want to
type the title and the path and name of a pdf file. The content of this file
should be stored pdf in the scope of the table.
In visualization, I want to get a list with titles and next to each title a
button to display the contents of the pdf field in Acrobat Reader.
My questions are:
-- What kind of field use in the table to receive the contents of pdf ?
-- How to send the contents of pdf in the field?
-- How to display the contents of the field in acrobat reader?
It's certainly very basic but I started in php and mysql. Be indulgent ... A
small piece of code would help me greatly, I thank you in advance.
Marc.
Re: Storing and displaying PDF in MySQL and PHP
am 31.03.2008 17:44:09 von nn
On Mon, 31 Mar 2008 16:16:51 +0200, "Merou63"
wrote:
>Hello, everybody!
>
>Here's what I want to achieve:
>In a table of a DB mysql, I would have 2 fields: a text box (a title) and a
>field capable of storing the contents of a pdf.
>I want to add (delete, modify) records. When I add a new record, I want to
>type the title and the path and name of a pdf file. The content of this file
>should be stored pdf in the scope of the table.
>In visualization, I want to get a list with titles and next to each title a
>button to display the contents of the pdf field in Acrobat Reader.
>
>My questions are:
>-- What kind of field use in the table to receive the contents of pdf ?
>-- How to send the contents of pdf in the field?
>-- How to display the contents of the field in acrobat reader?
>
>It's certainly very basic but I started in php and mysql. Be indulgent ... A
>small piece of code would help me greatly, I thank you in advance.
>
>Marc.
>
why don't you store, in the second field (varchar), a link to the pdf
that you want to dsiplay instead of storing the pdf itself?
it will save you a lot of space in the table and then if you decide to
modify the pdf you don't have to modify the table.
NN
Re: Storing and displaying PDF in MySQL and PHP
am 31.03.2008 19:13:36 von Jerry Stuckle
Merou63 wrote:
> Hello, everybody!
>
> Here's what I want to achieve:
> In a table of a DB mysql, I would have 2 fields: a text box (a title) and a
> field capable of storing the contents of a pdf.
> I want to add (delete, modify) records. When I add a new record, I want to
> type the title and the path and name of a pdf file. The content of this file
> should be stored pdf in the scope of the table.
> In visualization, I want to get a list with titles and next to each title a
> button to display the contents of the pdf field in Acrobat Reader.
>
> My questions are:
> -- What kind of field use in the table to receive the contents of pdf ?
> -- How to send the contents of pdf in the field?
> -- How to display the contents of the field in acrobat reader?
>
> It's certainly very basic but I started in php and mysql. Be indulgent ... A
> small piece of code would help me greatly, I thank you in advance.
>
> Marc.
>
>
>
What kind of column to use is a database question, and should be asked
in a newsgroup related to your database - in this case
comp.databases.mysql. Hint: you'll need a column big enough to store
the data, and since a PDF is binary data, the column needs to be a
binary type.
From the PHP end, adding, updating and deleting rows is pretty
straightforward. The fact you have a PDF vs. other data only makes a
minor difference - you'll need to read the PDF into a variable (check
out fopen(), fread() and fclose()) then store it in the table.
For this and retrieving the data you'll need some fairly basic SQL. But
all of it is a bit much for a few newsgroup postings. I'd recommend you
search for some basic tutorials on PHP and MySQL. There are some good
ones out there which can help you (but sorry, right now I don't have any
pointers).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Storing and displaying PDF in MySQL and PHP
am 02.04.2008 15:23:45 von Merou63
Thank you very much for your help.
Marc.
"Merou63" a écrit dans le message de
news:fsqm2o$fml$1@news.brutele.be...
> Hello, everybody!
>
> Here's what I want to achieve:
> In a table of a DB mysql, I would have 2 fields: a text box (a title) and
a
> field capable of storing the contents of a pdf.
> I want to add (delete, modify) records. When I add a new record, I want to
> type the title and the path and name of a pdf file. The content of this
file
> should be stored pdf in the scope of the table.
> In visualization, I want to get a list with titles and next to each title
a
> button to display the contents of the pdf field in Acrobat Reader.
>
> My questions are:
> -- What kind of field use in the table to receive the contents of pdf ?
> -- How to send the contents of pdf in the field?
> -- How to display the contents of the field in acrobat reader?
>
> It's certainly very basic but I started in php and mysql. Be indulgent ...
A
> small piece of code would help me greatly, I thank you in advance.
>
> Marc.
>
>