Re: What's wrong with my function? :(

From: Date: Tue, 30 Oct 2001 20:56:13 +0000
Subject: Re: What's wrong with my function? :(
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-13870@lists.php.net to get a copy of this message
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 ]---------------------

« previous php.db (#13870) next »