Re: [PHP-DB] What's wrong with my function? :( From: TorrentUK (torrent <email protected>)
Date: 10/30/01

Yep, that'll be it.
Thanks for the help. :)

torrent

"Charles F. McKnight" <cfm <email protected>> wrote in message
news:Pine.LNX.4.21.0110301452520.17337-100000 <email protected>
>
>
> 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 <email protected> ICQ: 2794793 | certainty is absurd.
> cfm <email protected> PGP: 0x20A5BCE5 | -
Voltaire
> --------------------[
http://chucksays.mywebsitesucks.com ]---------------------
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>