Re: global variable problem - Mailing list pgsql-php

From Papp, Gyozo
Subject Re: global variable problem
Date
Msg-id 001501c1eac5$51a4db60$01fdfea9@jaguar
Whole thread Raw
In response to Re: global variable problem  ("Jules Alberts" <jules.alberts@arbodienst-limburg.nl>)
Responses Re: global variable problem
List pgsql-php
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.




pgsql-php by date:

Previous
From: "Jules Alberts"
Date:
Subject: Re: global variable problem
Next
From: "Jules Alberts"
Date:
Subject: Re: global variable problem