If I use a class to work with the database, I create a new object of this class, from which I call the function to execute the query, I connect to the database, execute the query, close the connection. I process the data, bring it to the page.
In theory, the script worked and disappeared.
When you re-request from the received page - again repeat the same action? Or something can be saved in the session, so as not to recreate the object?
I want to see an example (scheme) of the actions I described in the correct form.
On different sites they write differently, in the comments there are a lot of opinions “for” and “against” and it is not quite clear what is right and wrong from all.