Jump to content

Need to understand about ajax calls for phpfile


gauravjain

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.