php - Connection Resource Persistency in Parallel AJAX Calls -


let's have web application core process student data. there number of ways interface data, let's limit these two:

  • students class
  • students grade

through interface, can make single ajax call these students. sql statements differ interface, expect list of students regardless. there, want have multiple ajax calls made in parallel, 1 each student. specific processing occurs here. processing independent of interface--the requirement input student. processing done generation of pdf student report.

here's have done:

  • multiple interfaces making single ajax call, both same php file.
  • the php file goes through post , determines sql statement run. before asking, yes it's prepared , no don't use post directly in query.
  • i return array of students using json_encode.
  • i iterate on array of students generate student-specific documents in parallel using multiple ajax calls.

this fine , dandy , working intended. problem i'm opening multiple connections database: once initial obtaining of student data, , one every student. horribly inefficient! had thought using json_encode encode connection resource, documentation states not possible because resources cannot encoded json. while using threads enable me parallel process student data without having return initial php script, the server not configured pthreads.

given scenario, how 1 maintain single persistent connection resource across multiple parallel ajax calls? possible?


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -