Page 1 of 1

PHP and Postgres connection

Posted: Wed Jan 03, 2007 5:26 am
by lazaroskyr
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I wish to everyone a happy new year.
Here is my "silly" question.

I have this code:

Code: Select all

$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)
}
I cannot understand what is the reason that in the second function I lose connection to postgres and must reconnect...Can anyone help me?


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Jan 03, 2007 5:32 am
by onion2k

Posted: Wed Jan 03, 2007 6:34 am
by lazaroskyr
Thanks.I must do my homework more properly.