Afficher un message
Vieux 22/06/2008, 20h47   #6
Peter H. Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: returning partial executions to the user

On Sun, 22 Jun 2008 09:52:45 -0700 (PDT), lazy wrote:
> On Jun 22, 8:59am, 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 .

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


If it's REALLY an expensive query (that is, you've timed it, and it
takes irritatingly long, not just that you THINK it might be expensive
once you write it), spawn that query off to it's own process and have it
write the output to another table that you can read later. See the pcntl
functions at http://us3.php.net/manual/en/ref.pcntl.php for information
about how to do this.

--
"This place is evil! We need weapons! Crossbows! Rocket Launchers!
Rent-a-zilla!"
-- L33t Master Largo www.megatokyo.com
  Réponse avec citation
 
Page generated in 0,05609 seconds with 9 queries