Upload Query needed

I also noticed that the connection gets connected and right after every query, OP disconnects. Wouldn’t it be more efficient to set the connection and then only disconnect when every query has been executed? That being said, isn’t the __destruct function be appropriate for disconnecting as it will be called after the page has been done executing?

It is also a good idea to reuse the connection so wouldn’t it be wise to create the connection in the constructor and then reference it using $this-> instead of creating a new connection on ever query.

1 Like