Re: function
| From: | Matt McClanahan | Date: | Sat, 01 Jul 2000 20:34:53 +0000 |
| Subject: | Re: function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4291@lists.php.net to get a copy of this message | ||
On Sat, 1 Jul 2000, Nick Catalano wrote:
> Umm.. a lot of those varables are from outside of the function, and thus can
> not be used inside of the fuction...
Well, the only variable that looks like it'd be set outside the function
is $SQLDB. In which case you'd just need to declare it with a global
statement.
function checklink($name)
{
global $SQLDB;
..
..
}
Matt
> ----- Original Message -----
> From: "Bartosz Aninowski" <bart@sonik.pl>
> To: <php-general@lists.php.net>
> Sent: Saturday, July 01, 2000 1:57 PM
> Subject: [PHP] function
>
>
> > when I call this function browser shows
> > Warning: 0 is not a MySQL result index in /home/public_html/test.htmls on
> > line 17
> >
> >
> > 14 function checklink($name)
> > 15 {
> > 16 $result=mysql_db_query($SQLDB,"SELECT listname,tablename FROM info
> WHERE
> > user='bart'");
> > 17 $rows = mysql_fetch_array($result);
> > 18 rows[$name];
> > 19
> > 20 }
> > 21
> > 22 $var = checklink(listname);
> > 23 print ("$var");
> >
> > when I am not using function everything is ok
> >
> > Bart
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>