Re: [PHP-DB] What's wrong with my function? :( From: Charles F. McKnight (cfm <email protected>)
Date: 10/30/01

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>