Re: returning partial executions to the user



On Jun 22, 8:59 am, Iván Sánchez Ortega <ivansanchez-...@rroba-
escomposlinux.-.punto.-.org> wrote:
Jerry Stuckle wrote:
lazy wrote:
I want to write a  script such that it executes 2 mysql queries on the
server. But before executing the second query, I would like to return
the results of the first query to the user and then do my second query
or second query can go on asynchronously

If you totally *need* to do so, do it client-side. Make the browser request
the first set of data, and when loaded, make it request the second.
Javascript and some AJAX techniques will help.


Yeah, I thought of that, but the input data is same for both the
queries and it would be inefficient
request to send the same data again. The first query is the one the
user is waiting for and second query is more for internal
bookkeeping(which the user is not waiting for) but expensive query.



You don't find much on PHP threading because you don't typically do
multithreading in PHP.  Most PHP scripts (especially web based) are
meant to be short and sweet - get in, do the job and get out.

Also, multithreading in web servers' processes doesn't usually go very
well - output race conditions and messing with the webserver's threading
model are a recipe for disaster. I speak from experience here. Please don't
try to do threading using the PHP apache module if you don't want to get a
headache.

OTOH, threading goes well with local scripting (when the PHP script is not
tied to a webserver). In this case, the PHP POSIX API works like any other
language - learn to do multithreading in C, you already know how to do
multithreading in PHP.

Cheers,
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Proudly running Debian Linux with 2.6.24-1-amd64 kernel, KDE 3.5.9, and PHP
5.2.6-1 generating this signature.
Uptime: 17:53:17 up 14 days,  1:41,  4 users,  load average: 0.41, 0.62,
0.58

.



Relevant Pages

  • Re: returning partial executions to the user
    ... But before executing the second query, ... the results of the first query to the user and then do my second query ... Most PHP scripts are ... multithreading in web servers' processes doesn't usually go very ...
    (comp.lang.php)
  • Re: returning partial executions to the user
    ... I want to write a script such that it executes 2 mysql queries on the ... But before executing the second query, ... Are there any good docs on php threading. ...
    (comp.lang.php)
  • Is this Possible - PHP/MySQL
    ... I did research and found references to "sub-queries" not ... possible in MySQL (I am using 4.0.18-32 with PHP 4). ... The second query seems to always return an empty array. ...
    (comp.lang.php)
  • Re: Command button resetting a query parameter?
    ... The first query totals invoice on a daily basis: count, sum of sales and sum ... The second query will then add a count field of records, ...
    (microsoft.public.access.formscoding)
  • RE: Output to Macro action
    ... >Create a form with you dropdown (Listbox) and After Update run your macro ... >The action will be your first query, second query, etc, Close your form. ...
    (microsoft.public.access.queries)