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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:50:20+00:00 2026-05-23T08:50:20+00:00

I was puzzled when this query failed on me: $results = $this->Event->find(‘first’, array(‘conditions’=>array( ‘user_id’

  • 0

I was puzzled when this query failed on me:

$results = $this->Event->find('first', array('conditions'=>array(
    'user_id' => $user_id,
    'home_num' => $num
)));
var_dump($user_id, $num, $results); die;

which outputs:

string(4) "5166" string(5) "12931" bool(false)

Changing it simply to:

$results = $this->Event->find('list', array('conditions'=>array(
    'user_id' => $user_id,
    'home_num' => $num
)));
var_dump($user_id, $num, $results); die;

gives:

string(4) "5166" string(5) "12931" array(1) { [1569006]=> string(22) "User favourited a home" }

What am I missing here, with regards to how I’m using find(‘first’)?

EDITED TO ADD:

So the problem seems to lie in ambiguous column names. If I change my code to look for Event.user_id, instead of ambiguous user_id, there’s no longer an issue.

There’s still a question here though, I guess, which is – why would “list” not choke on an ambiguous column name where “first” or “all” die in flames? Something to do with it being a simpler sort of query, that doesn’t need to mess with related tables, I expect…

  • 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-05-23T08:50:21+00:00Added an answer on May 23, 2026 at 8:50 am

    Well, in the interests of providing a real answer to this question:

    The problem lay in ambiguous column names. If I changed my code to look for Event.user_id, instead of ambiguous user_id, there was no longer an issue.

    If future generations of CakePHPers can’t work out why their database queries are failing, looking for ambiguous column names in related tables may possibly help…

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

Sidebar

Related Questions

I am puzzled with a query. I need find out the LAST row added
Im a little puzzled here, can someone just look over this query and tell
I'm puzzled with this test script: #!perl use strict; use warnings; use encoding 'utf8';
This one has me puzzled. It seemed like an easy task, but the solution
This is a compiler error (slightly changed for readability). This one always puzzled me.
This really puzzled for hours, I searched all over the internet, but got no
I'm no javascript wiz, but am a bit puzzled as to how this is
I am a bit puzzled reading this: Gcc 4.5 online manual --- Standards section
this has me puzzled - I am no expert on page life cycle but
This one has always puzzled me, but i'm guessing there is a very sensible

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.