Re: Curious code behavior inside/outside function
| From: | CPT John W. Holmes | Date: | Wed, 24 Sep 2003 19:24:01 +0000 |
| Subject: | Re: Curious code behavior inside/outside function | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30670@lists.php.net to get a copy of this message | ||
From: "Karen Resplendo" <karenresplendo@yahoo.com>
> I can't get odbc call to work inside of a function. It works on the
outside, then I pass the recordset and fieldname to the function to use the
data. I would like to just have the whole odbc stuff inside the function. Am
I missing something obvious? This is the error I get for the odbc_do line:
> "Supplied argument is not a valid ODBC-Link resource"
[snip]
> ****************************
> This doesn't work:
>
> function isValidPWS($pws)
> {
> $data=odbc_do($connectionSDWIS,"EXEC sp_PWSExists '$pws'");
Scope issue. $connectionSDWIS is not defined within your function. Either
pass it to the function or make it global.
---John Holmes...