On Tuesday 30 October 2001 15:49, TorrentUK wrote:
> 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...

Your variable is not in scope.  Either pass your variable as a 
reference in the function definition:
function RatingFilter (&$sql) {
...
}

or use the global keyword to bring your variable into scope:
function RatingFilter () {
global $sql;
if ($br) {$sql.= " and beg_rate >= '2'";}
...
}

And follow the advice of Charles and read up on it so you know 
how they are different.


-- 
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