I am checking that all sections in a database have been completed, if each has then set a variable to say it is complete. I then check that all of those variables have been set as complete, if they have then open up some content on a page.
I am getting a problem though where my final if statement is saying sections are complete when they aren't.
Here's what I am doing
I have tried the final if statement with just each variable in turn and each work, it is when I look at them all together that I have the problem.
My problem must lie with the final if statement and the && operator but I have read every resource I can find on && and it loks to be ok. Can someone see a problem somewhere?
Thanks
I am getting a problem though where my final if statement is saying sections are complete when they aren't.
Here's what I am doing
Code:
//to start with set all as incomplete
$p1class = 'incomplete';
$CLINclass = 'incomplete';
$PCclass = 'incomplete';
$SGclass = 'incomplete';
$IPCclass = 'incomplete';
$RSclass = 'incomplete';
$CFclass = 'incomplete';
$PERFclass = 'incomplete';
//check to see if each section is complete
$queryp1 = my query
$num = $dbStuff->FetchNum($queryp1[0]);
if check complete {
$p1class = 'section-complete';
}
//repeat for all sections above. So now my variables are either set as 'section-complete' or 'incomplete'
//echoing these to the page correctly show complete or incomplete for each section, so far so good
//this is where things are going wrong
//now check that all sections are complete
if (($p1class) && ($CLINclass) && ($PCclass) && ($SGclass) && ($IPCclass) && ($RSclass) && ($CFclass) <> 'section-complete' ) {
$wohitsnotcomplete = 'STOP';
} else {
$wohitsnotcomplete = 'GO';
}
//now when I
echo $wohitsnotcomplete;
//even if some are incomplete it is printing as GO
I have tried the final if statement with just each variable in turn and each work, it is when I look at them all together that I have the problem.
My problem must lie with the final if statement and the && operator but I have read every resource I can find on && and it loks to be ok. Can someone see a problem somewhere?
Thanks