I wish to everyone a happy new year. Here is my "silly" question. I have this code: Code: [code] $conn = pg_connect(...) or die("Couldn't Connect: ".pg_last_error()); if(something) { insert_something(); } elseif(something else) { update_something(); } function insert_something() { ...some code...(works nice) } function update_something() { ...some code...(cannot connect to db- i must reconnect) } [/code] I cannot understand what is the reason that in the second function I lose connection to postgres and must reconnect...Can anyone help me?