Re: mysql to postgres migration blues...
| From: | Andrew Kreps | Date: | Thu, 23 Sep 2004 19:23:32 +0000 |
| Subject: | Re: mysql to postgres migration blues... | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36366@lists.php.net to get a copy of this message | ||
On Thu, 23 Sep 2004 20:51:52 +0200, Antoine <melser.anton@gmail.com> wrote:
> declaring it as global didn't seem to work -
>
> global $link;
> /* Connect to database */
> $link = pg_connect("dbname=movies host=localhost user=anton
> password=password")
The global keyword works a little bit differently in PHP. You need to
inform your function that your variable is global, as opposed to
declaring it as global outside the function. Like:
$link = "database connection"
function processData () {
global $link;
...
}