Help with While loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Vinnar
Forum Commoner
Posts: 32
Joined: Tue Feb 01, 2011 11:00 am

Help with While loop

Post by Vinnar »

Hey guys,

I got some questions about the while loop

It's dealing with the "qset" as you can see below:

Code: Select all

$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
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Help with While loop

Post by Darhazer »

Maybe you are entering in one of the 2 if statements. The code after 'return' won't be executed.

Also, try var_dump($qset) to check the actual value of the variable.
Post Reply