4
I’m raising a little back office in PHP, Mysql and HTML and I have a little doubt.
Table:
IDNoticia
Dia
Mes
Titulo
Noticia
Then in HTML/PHP I’ll do echo
to show the day, month, Title And News but I have a question regarding the Annex.
Because there may be news that has an attachment as I have in this HTML
<a href="#">Titulo Teste</a>
I can also put Attachment in Mysql and then how can I call Mysql to href
?
By attachment you mean an image? The image of the news?
– Rodrigo Rigotti
It can be an image, a PDF, another page.
– ChrisAdler
The idea of storing attachments in the database is not very good. It would be better to have a published folder with attachments. Example: http://www.seudominio.br/anexos/anexo1. You can save in the database the name of the annex in question.
– Jorge B.
To begin with, the news relationship with the attachment should be 1-to-n, in case you need more than one attachment per news item. Anyway, it is interesting to discriminate the type of attachment by means of a column, the virtual path of the attachment in another and save the file in the system file, instead of saving it in the database.
– Rodrigo Rigotti
I can put a folder with Attachment (PDF) because it will be the one I use the most. The only thing I had to put in Mysql was the path
– ChrisAdler
Yes @Chrisadler the path, or even only the name of the attachment, if the path is the same for all attachments.
– Jorge B.
Then it will be just the way. Then in Href just add a href="echo:title.pdf" For example?
– ChrisAdler