Re: What's wrong with my function? :(
| From: | TorrentUK | Date: | Tue, 30 Oct 2001 22:19:14 +0000 |
| Subject: | Re: What's wrong with my function? :( | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13872@lists.php.net to get a copy of this message | ||
Yep, that'll be it.
Thanks for the help. :)
torrent
"Charles F. McKnight" <cfm@mywebsitesucks.com> wrote in message
news:Pine.LNX.4.21.0110301452520.17337-100000@fusion.mywebsitesucks.com...
>
>
> On Tue, 30 Oct 2001, TorrentUK wrote:
>
> <SNIP>
>
> you either need to pass the variables to the function or use global
> variables in the function see
> http://www.php.net/manual/en/language.variables.scope.php
>
> > Here's the code...
> >
> > // Define the rating's filter
> > <?php
> > function RatingFilter () {
> > if ($br) {$sql.= " and beg_rate >= '2'";}
> >
> > if ($ir) {$sql.= " and int_rate >= '2'";}
> >
> > if ($ar) {$sql.= " and adv_rate >= '2'";}
> >
> > if ($sr) {$sql.= " and sbd_rate >= '2'";}
> >
> > }
> > ?>
> >
> >
> > if ($search) {
> >
> > include ('logon-inc.php');
> >
> > $sql = "SELECT rsrt_name, ctry_name FROM resort_tbl WHERE
> > ctry_name='$country[0]'";
> >
> > RatingFilter(); <--- If I put 'if' statement here instead it works
> >
> >
> > for ($n=1; count($country) > $n; $n++){
> >
> > $sql.= " or ctry_name='$country[$n]'";
> >
> > RatingFilter(); <-- Or here
> > }
> > .
> > .
> > .
> > .
> > }
> >
> >
> >
> >
> >
>
> --
> Charles F. McKnight IRC: sokudo | Doubt is not a pleasant
condition, but
> cfm@myemailsucks.com ICQ: 2794793 | certainty is absurd.
> cfm@roge.smhs.com PGP: 0x20A5BCE5 | -
Voltaire
> --------------------[
http://chucksays.mywebsitesucks.com
]---------------------
>