Answer the question
In order to leave comments, you need to log in
How to make posts just with text and text + photo?
It is necessary that the posts on the site work, for example, on Twitter or Vkontakte.
That is, if I want to publish just text, then just text will be published, well, there are no problems with this, the problem is how to make such a post, for example, text + photo.
I think what needs to be done in the table with posts is two more fields hasImg and imgName. And after already when deriving from the database, check with if'om if hasImg = 1 then display the picture for display. So? or what do you recommend?
Here is an example of posting a photo and text from twitter...
Answer the question
In order to leave comments, you need to log in
If you do it in a simple and good way:
1. Post table entry:
id
title
text
...
id
img
post_id
...
. It’s good to link these fields in the database (depending on the engine) Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question