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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:43:55+00:00 2026-06-18T14:43:55+00:00

What do I want to do I want to list data that is pulled

  • 0

What do I want to do

I want to list data that is pulled from the database with a certain condition.

What do I have and what does it do

I have a function that calls the data. When I print_r the data, it throws the correct stuff, so the query is executing directly. However, the display isn’t working. It shows all the data in the database.

Here is my function:

public function myfunction() {
    $adminExtensions = $this->AdminExtension->find('all',
        array(
            'conditions' => array('location_id'=>'3')
        )
    );
    //print_r($adminExtensions);
    $this->set('adminExtensions', $this->paginate());
}

What is the problem

The problem, as stated, is that it doesn’t list just the records with location_id == 3. It lists everything.

I have narrowed it down to the last line of the function, but I can’t seem to get the right code in there.

My display file (myfunction.ctp) is a basic baked cakePHP index file.

What am I doing wrong?

  • 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-18T14:43:56+00:00Added an answer on June 18, 2026 at 2:43 pm

    The code you currently have calls two different find operations. $this->AdminExtension->find() will return an array with all the AdminExtensions with a location_id of 3. The second $this->paginate() call just returns all possible results suitable for pagination in the view.

    If you want to filter the paginated results you have to either configure the $paginate variable in the Controller or do it directly before you call $this->paginate.

    class PostsController extends AppController {
      public $paginate = array(
        'conditions' => array('location_id'=>'3')
      );
    }
    

    This will adjust pagination for all $this->paginate calls in the controller.

    To do it for only one paginate call:

    public function your_view() {
       $this->set('adminExtensions', $this->paginate('AdminExtension', array('location_id' => '3')));
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a list from some data that I have in my
I have a long list of data that I want to display in table
I have a list of data points (0.2, 0.8, 0.95) that I want to
I created the list that have device detected, and I want to send data
I have a list of data that I want to search through. This new
I have a list of stockmarket data pulled from Yahoo in a pandas DataFrame
So I have some data that gets pulled from another rails app in a
I have a list of data that i have in a view from an
I have a List of data that I want to bind to a SelectList
I have a list of items that is dynamically pulled from a web service.

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.