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

  • Home
  • SEARCH
  • 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 8548851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:35:32+00:00 2026-06-11T13:35:32+00:00

Possible Duplicate: CakePHP website crashing after pagination I had a page that worked but

  • 0

Possible Duplicate:
CakePHP website crashing after pagination

I had a page that worked but then decided to add in the functionality of pagination – it worked on that page and now trying to copy it over to another page I am now getting pdo database errors. saying that the variable Relationship.sender_id doesn’t exist.

I have a relationship table which contains – id, sender_id, receiver_id, expiry_date,active

here is the code in the function

    public function index_admin(){

    //retrieve Account Id of current User       
    $accountid=$this->Auth->user('account_id');

    //Conditions
    $conditions=array(
    "OR"=> array(
        'Relationship.sender_id' => $accountid,
        'Relationship.receiver_id' => $accountid)
    );

    //Find all Relationships where receiver_id = accountid
    $relationships=$this->Relationship->find('all', array(
    'conditions' => $conditions));


    $compName = $this->Account->field('account_name', array('id' => 'Relationship.id'));

    $this->paginate = array(
    'limit' => 10,
    'conditions'=> $conditions);

    $this->set('accountid', $accountid); 
    $this->set('relationship', $this->paginate());  

    $this->set('compName', $compName);  
}

this has really thrown me, any help would be appreciated.

this is the sql query the code creates

SELECT `Relationship`.`id`, `Relationship`.`sender_id`, `Relationship`.`receiver_id`,
 `Relationship`.`active`, `Relationship`.`requested`, `Relationship`.`expiry_date`, 
`ReceiverAccount`.`id`, `ReceiverAccount`.`street`, `ReceiverAccount`.`city`, 
`ReceiverAccount`.`postcode`, `ReceiverAccount`.`state`, `ReceiverAccount`.`country`,
 `ReceiverAccount`.`active`, `ReceiverAccount`.`account_name`, `ReceiverAccount`.`abn`,
 `SenderAccount`.`id`, `SenderAccount`.`street`, `SenderAccount`.`city`, 
`SenderAccount`.`postcode`, `SenderAccount`.`state`, `SenderAccount`.`country`, 
`SenderAccount`.`active`, `SenderAccount`.`account_name`, `SenderAccount`.`abn` 
FROM 
`pra`.`relationships` AS `Relationship` LEFT JOIN 
`pra`.`accounts` AS `ReceiverAccount` ON (
`Relationship`.`receiver_id` = `ReceiverAccount`.`id`) LEFT JOIN 
`pra`.`accounts` AS `SenderAccount` ON (
`Relationship`.`sender_id` = `SenderAccount`.`id`) WHERE (
(`Relationship`.`sender_id` = 2) OR (`Relationship`.`receiver_id` = 2))

when I debug $relationships after commenting out the pagination, I get the following output

array(
    (int) 0 => array(
        'Relationship' => array(
            'id' => '5',
            'sender_id' => '3',
            'receiver_id' => '2',
            'active' => false,
            'requested' => false,
            'expiry_date' => '2012-05-09'
        ),
        'ReceiverAccount' => array(
            'id' => '2',
            'street' => '50 Simmington Circuit',
            'city' => 'Greenvale',
            'postcode' => '3059',
            'state' => 'VIC',
            'country' => 'Australia',
            'active' => true,
            'account_name' => 'Kialla Transport (Operations) Pty Ltd',
            'abn' => '2147483647'
        ),
        'SenderAccount' => array(
            'id' => '3',
            'street' => '31 Simmington Circuit',
            'city' => 'Greenvale',
            'postcode' => '3059',
            'state' => 'VIC',
            'country' => 'Australia',
            'active' => true,
            'account_name' => 'MGD Kialla Pty Ltd',
            'abn' => '2147483647'
        )
    ),
  • 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-11T13:35:34+00:00Added an answer on June 11, 2026 at 1:35 pm

    remove lines:

    $this->paginate = array(
    'limit' => 10,
    'conditions'=> $conditions);
    

    at the top of the Relationship controller add variable:

    public $paginate = array(
      'Relationship' = > array(
        'limit' => 10)
       )
    );
    

    then try:

    $this->set('relationship', $this->paginate('Relationship', $conditions));  
    

    this hould solve the problem…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: CakePHP: Call to a member function find() on a non-object I have
Possible Duplicate: array_splice() for associative arrays How to add an array value to the
Possible Duplicate: Opening url in new tab while i am doing window.open(), my page
Possible Duplicate: PHP: self vs. $this What does $this-> mean in CakePHP? Please answer
Possible Duplicate: Return Value from inside of $.ajax() function I'm working on a CakePHP
Possible Duplicate: Unload a module in Python After importing Numpy, lets say I want
Possible Duplicate: How would I identify if a website originates from a mobile browser?
Possible Duplicate: git - removing a file from source control (but not from the
Possible Duplicate: QString to char conversion I have a function (fopen in STL) that
Possible Duplicate: What is the difference between save and saveAll function in cakephp? 66

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.