So I have this survey that I am pulling results from and I have to basically make a bunch of if...else if...
statements involving which feedback is submitted.
I have set it up to work correctly...except for one problem. I know it's probably something stupid, but for the life of me I can't figure it out.
Anyways here is the code.
if (($QID_A == 23) && ($row_result_2['Feedback'] == "")) {
echo "";
}
else if (($QID_A == 23) && ($row_result_2['Feedback'] <= 3)) {
echo $row_custom['Content'];
}
else if (($QID_A == 23) && ($row_result_2['Feedback'] == 4) || ($row_result_2['Feedback'] == 5) || ($row_result_2['Feedback'] == 6)) {
echo $row_custom['Content2'];
}
else if (($QID_A == 23) && ($row_result_2['Feedback'] >= 7)) {
echo $row_custom['Content3'];
}
The problem I am getting is if $row_result_2['Feedback']
is ==
to 5 or 6. It just repeats the line over and over again, basically failing to evaluate. It works fine for 4, so I am thinking my problem is somewhere in how I set up the ||
statements?
Any help would be appreciated. Thank you.
While I'm at it would there be a simpler way to write this statement? So i don't have to copy it for each QID_A
field 1-50?
UPDATE:: At this point I am at a loss as to why none of the below solutions are working.. I think this might be a deeper issue as the results are still repeating 24 times... Being that QID_A is 23 I think this might be related.. but I can't seem to find a connection... Thanks again for the help though guys I appreciate it.
Just for the hell of it I tried writing the statements out individually.... same result... for example.
if (($QID_A == 22) && ($row_result_2['Feedback'] == "")) {
echo "";
}
else if (($QID_A == 22) && ($row_result_2['Feedback'] <= 3)) {
echo $row_custom['Content'];
}
else if (($QID_A == 22) && ($row_result_2['Feedback'] == 4)) {
echo $row_custom['Content2'];
}
else if (($QID_A == 22) && ($row_result_2['Feedback'] == 5)) {
echo $row_custom['Content2'];
}
else if (($QID_A == 22) && ($row_result_2['Feedback'] == 6)) {
echo $row_custom['Content2'];
}
else if (($QID_A == 22) && ($row_result_2['Feedback'] >= 7)) {
echo $row_custom['Content3'];
}