Small Back Office

Asked

Viewed 358 times

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?

  • 1

    By attachment you mean an image? The image of the news?

  • It can be an image, a PDF, another page.

  • 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.

  • 1

    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.

  • 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

  • Yes @Chrisadler the path, or even only the name of the attachment, if the path is the same for all attachments.

  • Then it will be just the way. Then in Href just add a href="echo:title.pdf" For example?

Show 2 more comments

1 answer

0

Hello! It is indicated to store in the database the path/reference to the file.

Once stored in your href, you can place the contents of the attached column and it will already be linked to your file.

Remembering that you need to check if the file is really in the indicated path.

  • That’s right there. It is more appropriate to put only the path of the attachment to the bank and upload the attachment to a specific folder.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.