X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C1BD5D1CA65 for ; Tue, 18 Nov 2003 02:52:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 16596-02 for ; Mon, 17 Nov 2003 22:52:04 -0400 (AST) Received: from ALPHA9.ITS.MONASH.EDU.AU (alpha9.its.monash.edu.au [130.194.1.9]) by svr1.postgresql.org (Postfix) with ESMTP id 9EE23D1CAD0 for ; Mon, 17 Nov 2003 22:49:19 -0400 (AST) Received: from localhost ([130.194.13.84]) by vaxh.its.monash.edu.au (PMDF V5.2-31 #39306) with ESMTP id <01L36G6XAYB28ZRW5V@vaxh.its.monash.edu.au> for pgsql-php@postgresql.org; Tue, 18 Nov 2003 13:31:48 +1100 Received: from blammo.its.monash.edu.au (localhost.its.monash.edu.au [127.0.0.1]) by localhost (Postfix) with ESMTP id 6250F39C003 for ; Tue, 18 Nov 2003 13:31:48 +1100 (EST) Received: from med.monash.edu.au (cl-13B-103-akira-whisstock.med.monash.edu.au [130.194.193.147]) by blammo.its.monash.edu.au (Postfix) with ESMTP id 43B592DC003 for ; Tue, 18 Nov 2003 13:31:48 +1100 (EST) Date: Tue, 18 Nov 2003 13:33:30 +1100 From: Noel Subject: Cancel a query when user leaves a web page To: pgsql-php@postgresql.org Message-id: <3FB984FA.1090003@med.monash.edu.au> MIME-version: 1.0 Content-type: MULTIPART/ALTERNATIVE; BOUNDARY="Boundary_(ID_HmeUQXJ/q/MVS8FcWBpQCw)" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/41 X-Sequence-Number: 2434 This is a multi-part message in MIME format. --Boundary_(ID_HmeUQXJ/q/MVS8FcWBpQCw) Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7BIT Hi all, I have a small problem. Is it possible to cancel a running query when a person leave or pressed the stop button in my web page. I've been thinking about mixing php and javascript. Is this the best way to go about it? basic out line of my code: ....stuff.... ...stuff The query can take some time. And when the page is left the query is still running on postmaster. Have tried )> The function, close_connection($connection), is defined in the include file, which is the connection is busy, cancels the query and closes the connection. This gives the following error: Resource id #1 Warning: pg_send_query(): 1 is not a valid PostgreSQL link resource in /home/fauxn/public_html/singleAArepeats/test.php on line 11 Any suggestions welcome. Many thanks -- Noel Faux Department of Biochemistry and Molecular Biology Monash University Clayton 3168 Victoria Australia --Boundary_(ID_HmeUQXJ/q/MVS8FcWBpQCw) Content-type: text/html; charset=us-ascii Content-transfer-encoding: 7BIT Hi all,

I have a small problem. Is it possible to cancel a running query when a person leave or pressed the stop button in my web page.

I've been thinking about mixing php and javascript. Is this the best way to go about it?

basic out line of my code:
<html><head>....stuff....</head>
<body>...stuff
<?php
    $connection = pg_connect(host, dbname, user);

    pg_send_query($connection, "SELECT * FROM blah");

    // collect the results and display etc..
?>
</body></html>
The query can take some time.
And when the page is left the query is still running on postmaster.

Have tried
<?php
    include "functions.php";
    $connection = pg_connect(host, dbname, user);
?>
<html><body onunload(<?close_connection($connection)?>)>
<?php
    echo $connection;
    pg_send_query($connection, "SELECT * FROM blah");

    // collect the results and display etc..
?>
</body></html>

The function, close_connection($connection), is defined in the include file, which is the connection is busy, cancels the query and closes the connection.

This gives the following error:

Resource id #1
Warning: pg_send_query(): 1 is not a valid PostgreSQL link resource in /home/fauxn/public_html/singleAArepeats/test.php on line 11

Any suggestions welcome.

Many thanks
-- 
Noel Faux
Department of Biochemistry and Molecular Biology
Monash University
Clayton 3168
Victoria
Australia
--Boundary_(ID_HmeUQXJ/q/MVS8FcWBpQCw)--