lazy wrote:
> Hi,
> 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
>
> Something like
>
> <?php
> $q1=...
> mysql_query($q1)
> //return the result to user before rest of the script executes
>
> $q2 = ..
>
> ?>
>
> Is it possible anyway to flush the output of 1st query to the user
> before doing the 2nd query. Can it be done without threading?
>
> ps: Are there any good docs on php threading. Googling didnt much
>
> thx
>
You can't reliably write output to the browser. You can flush the PHP
buffer, but the web server also has a buffer - and it won't send data
until its buffer is filled. Also, the browser won't necessarily show
incomplete data - again, depending on the browser.
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.
If you really require such a function, you may have to look at other
languages - a java applet can easily do what you want, for instance.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================