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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:26:39+00:00 2026-06-13T22:26:39+00:00

I am making a Zend framework method for a search engine. Because i search

  • 0

I am making a Zend framework method for a search engine. Because i search through different tables i also have to make two different select variables and return it. My questions are: Is this a good idea for a search engine with different tables?

And how to return the different resuls in an array? (fetchall->$selectMovies, fetchall->$selectPosts)

Thanks and greetz Eric

public function search($keyword) {
        $selectPosts = $this->select();
        $selectPosts->from('posts', array('*'));
        $selectPosts->where('posts.post_title LIKE ? OR  posts.post_body LIKE ?', '%'. $keyword . '%' );

        $tblMovies = new Model_DbTable_Film();
        $selectMovies = $tblMovies->select();
        $selectMovies->from('film', array('*'));
        $selectMovies->where('film.titel LIKE ? OR  film.omschrijving LIKE ?', '%'. $keyword . '%' );

        //var_dump($this->fetchAll($selectPosts, $selectMovies)); die;
        return $this->fetchAll($selectMovies);
        return $this->fetchAll($selectPosts); 

    }
  • 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-13T22:26:42+00:00Added an answer on June 13, 2026 at 10:26 pm

    You can only return once, but what you can do is return an array of your result arrays.

    <?php 
    public function search($keyword) {
        $selectPosts = $this->select();
        $selectPosts->from('posts', array('*'));
        $selectPosts->where('posts.post_title LIKE ? OR  posts.post_body LIKE ?', '%'. $keyword . '%' );
    
        $tblMovies = new Model_DbTable_Film();
        $selectMovies = $tblMovies->select();
        $selectMovies->from('film', array('*'));
        $selectMovies->where('film.titel LIKE ? OR  film.omschrijving LIKE ?', '%'. $keyword . '%' );
    
        //var_dump($this->fetchAll($selectPosts, $selectMovies)); die;
    
        return array('movies'=>$this->fetchAll($selectMovies),
                     'posts'=>$this->fetchAll($selectPosts));
    }
    ?>
    

    Or split up your method into 2 and pass a type of search as a parameter to the main search method:

    <?php 
    public function search($keyword,$type) {
        return $this->{$type}($keyword);
    }
    
    public function search_movies($keyword) {
        $tblMovies = new Model_DbTable_Film();
        $selectMovies = $tblMovies->select();
        $selectMovies->from('film', array('*'));
        $selectMovies->where('film.titel LIKE ? OR  film.omschrijving LIKE ?', '%'. $keyword . '%' );
        return $this->fetchAll($selectMovies);
    }
    
    public function search_posts($keyword) {
        $selectPosts = $this->select();
        $selectPosts->from('posts', array('*'));
        $selectPosts->where('posts.post_title LIKE ? OR  posts.post_body LIKE ?', '%'. $keyword . '%' );
        return $this->fetchAll($selectPosts);
    }
    ?>
    
    <?php 
    $result['movies'] = $model->search($keyword,'search_movies');
    $result['posts'] = $model->search($keyword,'search_posts');
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Zend Framework application that is making use of jQuery UI. In
I have a made website in Zend Framework. Now I am making the same
I am making a classified ads site with Zend Framework (for portfolio purposes, yes
I am making a PHP image uploader using the Zend Framework which will upload
Hi Zend framework guys, I have a question for you : There is production
I'm building a web application with the Zend Framework. I have wanted to include
I'm using a traditional Zend framework application generated using Zend tool . I have
I'm making my first zend application, but I have problems with the autoload of
I am using Zend Framework and also try to move towards DDD approach (Domain-Driven
I have been using the Zend Framework with an MVC configuration, read about Ruby

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.