Jump to content

Recommended Posts

hello

 

I have a php file name abc.php . in that i call db connection file. in same file i want to call data from another php file. then i did following code

 

$.ajax({

     type: "GET",
     url: 'aa.php',

data: "fid=" + fid,

$(ffid).html(data);

 

i want to know when we use following jquery code then it call aa.php then that also contain the same db connection file

 

my question is when i call connection file in abc.php and then same time i call aa.php using ajax then database connection file include 2 times then 2 connection will open or when we open connection  once then again it do not open again even i call 10 php files using ajax? or if call 10 php files using aax and all have conn file then 10 more connections will open?

 

How exactly db connection work when open once

 

A new database connection will be opened on each request. The first connection will be when you call abc.php and the second connection will be for the ajax request. PHP will close the database connection as soon as PHP has finished parsing the script.

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.