pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Papp, Gyozo <pgerzson@freestart.hu>
To: jules.alberts@arbodienst-limburg.nl
To: pgsql-php@postgresql.org
Subject: Re: global variable problem
Date: Tue, 23 Apr 2002 13:12:21 +0200
Message-ID: <001501c1eac5$51a4db60$01fdfea9@jaguar> (raw)
References: <200204230643.g3N6hEQw020907@artemis.cuci.nl>
	<200204231033.g3NAX9Qw028301@artemis.cuci.nl>


hi,

 
| > The script ends when the .php file reach it's end( when there is noting
| > more to parse/ and or execute ).

in general this is the case. If you must do somethign after all output sent to 
the browser you can register one or more shutdown function to process in hide.
But it's not so common.


| i have a feeling it's more complex than that. a script calls itself, 
| rebuilds HTML code. has the script ended or not? the script that did 

It's up to at all.

| the call has ended. but since it has called itself, it hasn't. i find 
| these recursion matters a bit vague when it comes to scipts that 
| generate themselves.


Tere is no recursion, it's  a different thing. You can avoid it with some
so called state variable.

switch ($status){
case 'BUILD_FORM_FIRST':
case 'CHECK_FORM':
case 'SHOW_RESULT':
}

| 
| > > - why is the variable $conn visible in start(), but not in listing()?
| > 
| > If you want to have access to a global var. inside of a function, you
| > must say that the global var. is global. Ex:
| 
| i did that, it doesn't make any difference
 

I'm afraid that you didn't reopen the connection in show.php. 
you must initialize each variable in each separate page, because each script
is a totally independent program from each other. SESSION can ease your work
but resources such as connection, result sets, cannot be registered in a 
session.

| > doing a roolback in this connection, doest it will roolback all scripts?

No, at the end of the script PHP sends a ROLLBACK automatically to 
postgres. So it can rollback the queries in the actual request (page) only.






view thread (7+ messages)  latest in thread

Message-ID: <001501c1eac5$51a4db60$01fdfea9@jaguar>
Permalink:  ../001501c1eac5$51a4db60$01fdfea9@jaguar/
Also on:    postgresql.org/message-id/001501c1eac5$51a4db60$01fdfea9@jaguar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: pgerzson@freestart.hu, jules.alberts@arbodienst-limburg.nl
  Subject: Re: global variable problem
  In-Reply-To: <001501c1eac5$51a4db60$01fdfea9@jaguar>
  References: <200204230643.g3N6hEQw020907@artemis.cuci.nl> <200204231033.g3NAX9Qw028301@artemis.cuci.nl> <001501c1eac5$51a4db60$01fdfea9@jaguar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox