Re: global variable problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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.





[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux