Jump to content

persistent mysql database connection


samona

Recommended Posts

I was wondering what the users at phpfreaks recommend as far as persistent database connections.  Is it better to save the connection, or to open up a new connection for each page? 

 

Also, how would you have a persistent connection? 

Link to comment
Share on other sites

Thanks for the response.

 

I want to create a login system using a mysql database instead of the default filesystem.  I'm just wondering if its better to tear down the connection after each page and rebuild it on the next one. 

 

Also,I want to use object so I'm wondering if I should serialize those object or just store the values in the database and query them using the saved session value.

Link to comment
Share on other sites

Persistent database connections cannot be 'saved'. You must still call the code on every page to get one of the existing persistent connections or to create a new persistent connection if an existing one is not available.

 

Edit, Also, persistent connections only work on a very few web server/php configurations and in only the latest php versions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.