Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7698529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:15:48+00:00 2026-05-31T22:15:48+00:00

I have a situation in my project where I have to keep using a

  • 0

I have a situation in my project where I have to keep using a lot of SQL queries. I have two questions here, one is, once a create a connection with a database, does it remain persistent throughout all my web pages ? i.e., my client remains connected with the mySQL server throughout. If yes, then is it a safe option to save my mySQL link identifier as a session variable i.e.,

$_SESSION['link'] = $link //( $link is mysql link identifier )

and therefore use this variable throughout my web pages, thereby only having one connection to the database. I cannot use

mysql_pconnect().

My second question is, is it fine to keep keep connecting and disconnecting from the database time and again. Is it a a good practice ? I am using mySQL server but have only limited access to it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:15:49+00:00Added an answer on May 31, 2026 at 10:15 pm

    My opinion is, that you do not save nor win anything when you try store your $link to session.

    You have to make connection to sql server for each page data load. Is the same as if you include file. If this variable is stored in session or not brings a same efect – it’s same cost of memory in the end count.

    Must now – after you load the page the show is over 🙂 connection are lost, only content of your sessions left. ((Yes, it depends on your webhost settings if it is closing db connection automatically or in some time period or is waiting till you will do it with command. The last is the best for saving resources))

    You should start thinking about stotring the loaded contnet to session or file. Then you can save connections and data loads from external resources, what was maybe your base idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my situation: I have a C project linking with many libraries (I
I have a fairly standard inheritance situation in my current LINQ-to-SQL project. I have
I have the following situation Project A - Uses Castle Windsor v2.2 - Uses
I have a following situation in my project. There are some tag values which
I have a situation where another developer is including source files from a project
Situation I have been working on a project lately where the UI development seems
I have the following situation. My project has a main.scala.html file and a folder
This is not a ruby/rails project deploy. I have the following situation and I
So I've got a situation where we have a project with 10 developers. Each
There are a lot of complex forms in my project and I keep getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.