Doubt with access level and login in PHP

3

Well I have a question and wanted the opinion of more experienced people.

I have a system in PHP that uses Mysql. I have a table called 'access' where saved the options that the user has to access the system. The problem is that every time I load the page I have to do the 'select' in the DB.

I want to improve the performance of the system, and I have taken several steps to do this. And one of them is trying to narrow the 'select'.

Well let's doubt, what I want to know is: 1- Is this the best way to do this? 2- Would it be easier to save the user's permissions in the session, to avoid the select? 3- Is reading the session faster than the select in BD?

Well, I look forward to helping you with a good solution.

    
asked by anonymous 19.12.2016 / 23:13

1 answer

3

1- Is this the best way to do this?

No, because every time you access the database, you lose time.

2 - Would it be easier to save the user's permissions in the session, to avoid the select?

Yes, this is the best solution in my opinion (there may be others), so you will not have to consult your bank every time you open the page.

3- Is session reading faster than select in BD?

Yes

    
19.12.2016 / 23:41