Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7717397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:53:16+00:00 2026-06-01T02:53:16+00:00

So I have this survey that I am pulling results from and I have

  • 0

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']; 
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:53:17+00:00Added an answer on June 1, 2026 at 2:53 am

    You need an extra pair of brackets to make it obvious what the precedence should be with your operators (and you don’t need the brackets round each expression):

    else if ($QID_A == 23 && ($row_result_2['Feedback'] == 4 || $row_result_2['Feedback'] == 5 || $row_result_2['Feedback'] == 6)) {
    

    echo $row_custom[‘Content2’];
    }

    But you might be better off writing this logic use a case so it’s clearer, i.e.

    if ($QID_A == 23) {
        switch( $row_result_2['Feedback'] ) {
          case '':
            echo '';
            break;
          case 0:
          case 1:
          case 2:
          case 3:
            echo $row_custom['Content'];
            break;
          case 4:
          case 5:
          case 6:
            echo $row_custom['Content2'];
            break;
          default:
            echo $row_custom['Content3']; 
            break;
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview that pulls from an sqldatasource, this sql datasource pulls from
I have a working survey that pulls each question and any related answers from
I have some code that pulls data from a mysql db everything is pulling
I have a viewmodel (survey) that has a member (questions.current) which is an indexer
I have a survey-type form that's being populated from a web database on the
I have data from a survey. It comes from a question that looks like
I have this old survey link that is has been superseded by another link,
I have a XML file like this <?xml version=1.0 encoding=utf-8?> <Survey Name=Aerosmith's Survey Id=S2
I have this form, in which i need to populate a combo box with
I have a survey that's stored in a large object graph of variable depth,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.