Hi Gang,
Brain totally not working today.
So, I have a few columns in a table that basically designate whether a certain piece of information WAS or WAS NOT provided by the user.
For example, I have a table with:
| ID | USER | crit1 | crit2 | crit3 | crit4 | etc. |
Now, the record could have a 1 or yes for any of the "critX" fields. I dunno much about math and permutations, but I guess if there were 4 columns, you could have 16 combinations of output. In my real world example I have 16 different criteria, so I can't factor for the output of that mess. I need to write a routine of some sort.
In my example, each of those crit values is going to be evaluated and if the criterion == 1/yes, it will be included in another variable AND have a more human friendly bit of data assigned to it. I am currently pulling each value from the DB an doing something like
### first I pull the values
$mydbarray[crit1] = $cr1;
$mydbarray[crit2] = $cr2;
$mydbarray[crit3] = $cr3;
(etc...)
### then I assign some human friendly text ONLY if the value == 1/yes
if($cr1==1) ($cr1 = "This info is present!";}
if($cr2==1) ($cr2 = "Number two is present!";}
if($cr3==1) ($cr3 = "Three was provided!";}
Now, what I need to do, is collect all that output only if the "IF" fired on true and assemble into a final variable.
So somehow, I want:
$finaloutput = $cr1, $cr2, $cr3;
Obviously that's not valid or what I want, but even if it DID work, it would end up including all the == 0/no instances as well.
So essentially I need a conditional grouping of these variables and I am not getting it.
I was thinking of casting an array and looping through it, but then I was at a loss for including the human intelligible portions...
Some guy at work mentioned an IF statement using bool, but I am not wellversed there.
I would think this is easy, but I've been up all week with the baby. so my brain is broken.
Thanks in advance!!! Rob