0
How to write a code in java to find the number of views on a post
something like views on Quora question and answer
2 ответов
+ 5
Just increase the count everytime when people open the link. You can make a table in database with column views, question_id
Increase the counter of views everytime.
Same for answer views you can make another table with question_id, answer_id and views. Do same operation for this also.
+ 1
You mean to say as many times people visit the question a view will be shown.
It's a easy code though I never used it, you can do it by making a button in which the question is inputted and by which as many times people click the button there will be a increment of number +1
And so on..... just like in sololearning question....
But keep in mind that same people can visit the question again and again so on that case the view will also be increasing for that a block has to be created, which can be pretty easily made with if else condition