php - My website started to load slow after I added mysqli
I am sorry if there is lack of information I'm not that really good of explaining and English is not my native language.
After I designed the website with
html/css etc...I started to add
mysqli, to display the user information, tables.
I just glimmsed at your code: In every function, you are calling
db_login(), which opens every time a new database connection. Try to reuse the same database connection, would speed up a lot.
For example you can make a global variable, where you open the connection once and then import the variable via the global keyword, or you could pass the functions this variable as parameter. This best option though, would be designing the whole thing into a class, where the (open) connection is a shared variable of the instance of this class.