What's wrong with my function? :(
| From: | TorrentUK | Date: | Tue, 30 Oct 2001 20:49:48 +0000 |
| Subject: | What's wrong with my function? :( | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13868@lists.php.net to get a copy of this message | ||
Please could some take a look at this code and tell me why when I take my IF
statements out of the function and put in them in the same place where I
call the function from they work, but as soon as I replace them with the
function name they don't?
Appreciate any help.
torrent
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
}
.
.
.
.
}