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
[EMAIL PROTECTED]  ICQ: 2794793     | certainty is absurd.
[EMAIL PROTECTED]     PGP: 0x20A5BCE5  |                         - Voltaire
--------------------[ http://chucksays.mywebsitesucks.com ]---------------------


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to