Help with While loop

Hey guys,

I got some questions about the while loop

It’s dealing with the “qset” as you can see below:

$get = "SELECT qset from mailing_list where email = '$email'";
$result = mysqli_query($connect, $get) or die($connect);
while ($row = mysqli_fetch_array($result)){
extract($row);
$qset = rsort($row);
$qset = (int)end($row);

}

if (empty($qset) || $qset < 1){
$qset = 1;
return $qset;
} elseif ($qset >=1){
$qset = $qset + 1;
return $qset;
}

echo $qset;

Nothing echoed out… Why?

Also it seems like the script got stuck at the while loop, as no sql commands that follow up are processed

Any help is appreciated!

Thanks

return $qset;

Return? To what? Is it a function?
All code after the return is not executed. From the manual:

If called from the global scope, then execution of the current script file is ended.

ok so i took out the return statements and it seems to be working now so far

Thanks :slight_smile: