More on functions
| From: | Abe | Date: | Sun, 07 Jan 2001 19:44:14 +0000 |
| Subject: | More on functions | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-33110@lists.php.net to get a copy of this message | ||
Hey Guys -
This piece of code does not work for some reason. When the line of code is
taken out of the function it works fine. However when it is in the function
it behaves as though the function has not been executed. I set the
$connection variable to global but can't find what is wrong... Is there
something obvious I am missing?
function DatabaseConnect()
{
global $connection;
$connection = pg_connect("dbname=abe port=5435") or die ("Couldn't make a
connection.");
}
DatabaseConnect();
$sql = "select firstname etc etc etc etc ....";
$sql_result = pg_exec($connection,$sql);
Thanks,
Abe