When issuing a MySQL/SQL query from PHP code, a connection with the database must be firstly established.
Would you advise me, please, whether I should establish connection with the database only at the beginning of the user's web session, or upon loading new page, or before every single MySQL/SQL query?
I think that when establishing connection with the database too many times unnecessarily, I will consume unnecessary system resources. I would therefore prefer connecting with the database the minimum necessary times.