gauravjain Posted January 4, 2014 Share Posted January 4, 2014 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 Quote Link to comment https://forums.phpfreaks.com/topic/285086-need-to-understand-about-ajax-calls-for-phpfile/ Share on other sites More sharing options...
Ch0cu3r Posted January 4, 2014 Share Posted January 4, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/285086-need-to-understand-about-ajax-calls-for-phpfile/#findComment-1463845 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.