MySql : How to create a persistent connection that survives across page loads

I need help to setup/create a persistent MySql connection using mysqli_connect.
The point is to eliminate repeated connects every time I fetch a different thing from the database.

Is this even possible?
I tried to set up a connection variable in $_SESSION array but could not get it to work.

Thanks

Since you are using mysqli you can use persistant connections
http://php.net/manual/en/mysqli.persistconns.php

But do you really need/want to? Mysql connections are extremely fast to set up, sure this is actually something you want to do?

Thanks for the heads up on that. I will forget about that idea and just code as normal.
Thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service