You could try leaving off the ";"... Try $sql = "BEGIN"
Try $sql = "COMMIT" That should work... On Thu, 2003-01-09 at 22:23, Jean-Christian Imbeault wrote: > Jason Sheets wrote: > > > > Manual Excerpt: " If a second call is made to pg_connect() with the same > > connection_string, no new connection will be established, but instead, > > the connection resource of the already opened connection will be > > returned. You can have multiple connections to the same database if you > > use different connection string." > > You're right! I did some more testing and the problem is with my testing > code. I don't know why but the following code times out *but*, PHP > throws an error saying the code has timed out *but* calling > connection_status() says the code did *not* time out! > > Any idea why connection_status() returns 0 when it should return 2?? > > My code: > > set_time_limit(2); > echo "set execution limit to 2 seconds <BR>"; > register_shutdown_function("timed_out"); > require_once("db_functions/sql_query.inc"); > > $sql = "BEGIN;"; > $res = sql_query($sql); > $sql = "insert into test(test) values('testing 4');"; > $res = sql_query($sql); > > //This will cause the script to time out > $i = 0; > while(true) {$i++;} > > $sql = "COMMIT;"; > $res = sql_query($sql); > > function timed_out() { > $status = connection_status(); > if ($status == 2) { > echo "the script timed out <BR>"; > } > else echo "no time out. Connection status is $status <BR>"; > } > > The OUPUT: > > set execution limit to 2 seconds > > Fatal error: Maximum execution time of 2 seconds exceeded in > /www/htdocs/jc/shut.php on line 16 > no time out. Connection status is 0 > > Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php