Heres my function:
function get_r($groupid) {
if (!empty($groupid)) {
$groupid = explode(",", $groupid);
$rto = array();
$x=0;
while (count($groupid,$ustaffid) > $x) {
$q = mysql_query("SELECT * FROM groups WHERE id='$groupid[$x]'");
while ($get = mysql_fetch_assoc($q)){
$rto[] = $get['groupname'];
}
$x++;
}
$q = mysql_query("SELECT * FROM groups WHERE ustaffid='$ustaffid'");
$numofgroups = mysql_num_rows($q);
if ($numofgroups == count($groupid) && count($groupid) > 1) {
$rto = "All of my groups";
} else {
$rto = implode(", ",$rto);
return $rto;
}
}
}
when I call function I’m using this:
get_r($groupid);
What I’m trying to do is get the variable $rto from my function, I have supplied the function with the $groupid variable. $rto is returning empty.
Thanks for your help!
and:
Variable scope