Jump to content

While Loop Problem


shane18

Recommended Posts

I want to run a while loop that lists the persons groups if the person has groups enabled.....

 

while($GROUP = $GROUPS->fetch_object() && $GROUP_SET == 1){

 

Why doesn't this work?

 

$GROUP keeps equaling 1... but if I take out the

 

&& $GROUP_SET == 1

it doesn't equal 1...

Link to comment
https://forums.phpfreaks.com/topic/191260-while-loop-problem/
Share on other sites

That is how I would usually do it, but I'm trying to understand the why if/while statements behave like this...

 

while($GROUP = $GROUPS->fetch_object() && $GROUP_SET == 1){

-Don't Work

 

 

while($GROUP_SET == 1 && $GROUP = $GROUPS->fetch_object()){

-Works

 

Why does the order of the expressions make a change on whether it works or not?

Link to comment
https://forums.phpfreaks.com/topic/191260-while-loop-problem/#findComment-1008448
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.