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 7973513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:07:35+00:00 2026-06-04T08:07:35+00:00

I have been trying different solutions for this problem without success. Problem is this:

  • 0

I have been trying different solutions for this problem without success. Problem is this:

I have some results form Zend_Search_Lucene which give say 3 results with the ID of: 2, 3, 4

Then I have some records from an unrelated Query made with Doctrine which gives me say two records with the id ID: 2 and 3.

The results from Search Lucene should show on the page as total of 3 records. Of these I need to check if an ID is equal to another ID of the Docrine query, that is if there is a match ie: 2=2 , 3=3 show something, if not ie: 2=3 show another thing.

Trying to do this with FOREACH twice and an IF ELSE sttement but I get double results on the page:

foreach($this->results as $r):    //  records form search Lucene ie 2, 3, 4

    foreach($this->records2 as $r2){     // records from another table (query) 2 and 3

          if(($r2['id']) == ($r->id)) { 
                                      // do something

                            } else {
                              // dosothing else

    }

…etc.

I understand why the records are repeated twice but I dont’ know what is the right way to get the right result. Can someone please help?
My apology if there is some silly thing I am doing. 🙂

  • 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-04T08:07:36+00:00Added an answer on June 4, 2026 at 8:07 am
    foreach(... $r) {
      $found = false;
      foreach(... $r2) {
        if (... == ...) {
          $found = true; break;
        }
      }
      if ($found) {
        // something
      } else {
        // something else
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to parse the bottom table on this site using different
I have been trying to find the different between MVC and 3-tier architecture in
I am trying to learn assembly my self, and I have been reading different
I am sure this has been asked already, but I have been trying all
I have been trying to wrap my head around this for a while now
I have been working on this problem for close to 4 days now. I
I have been trying to wrap my head around why this is happening but
I've been going over this in my head and trying out different approaches for
I've been trying to smoothly animate some Windows Form location but I'm having some
I have been trying to get it to work using this thread but can't

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.