Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: Connection between client and server Date: Sun, 24 Jul 2016 10:44:07 +0200 Lines: 11 Message-ID: References: <7685ed66-ee5e-46a0-aeba-0bd9b408d286@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net SuXT/hH2MZX+/53/i/bS8AlYI5pL6w+Nm2nH5lNIxPSYU6Yz8Y Cancel-Lock: sha1:fhrSUF863YjJjemCqugL4ky8buI= X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: <7685ed66-ee5e-46a0-aeba-0bd9b408d286@googlegroups.com> Xref: csiph.com comp.lang.php:16875 On 07/24/16 09:51, bit-naughty@hotmail.com wrote: > If I have a page which say, echo's something, and then does stuff on the server side, eg. putting something inside a database, say - I was thinking of *FIRST* doing the echo'ing, and THEN doing the "stuff" - which obviously means that if the server crashes between the echo and the stuff, the task won't get done. But I'm also wondering what happens if someone clicks off that tab or closes the browser as soon as they see the text (whatever's been echo'd) - will that kill the process on the server side? Before it's completed whatever it was supposed to do? How do I prevent this? The process should in most cases execute to the end, but still the best practice is to execute things first and then give the output, as this way you can tell that something went wrong and ask the user to redo the post. -- //Aho