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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:06:56+00:00 2026-05-27T05:06:56+00:00

I want to know if it is possible to retrieve a row from the

  • 0

I want to know if it is possible to retrieve a row from the database using something similar to the following:

    if (!empty($this->params['form'])) {
        $place = array();
        $place['city'] = $this->params['form']['city'];
        $place['area'] = $this->params['form']['state'];
        $place['country'] = $this->params['form']['country'];
        $place['iso'] = $this->params['form']['iso'];

        $this->Place->set($place);
        $place_found = $this->Place->read();
    }

Is there some way I can preset the data in the Place model using the array and then use Place read. I’m looking for something simple like the usual:

$this->Place->id = 7;
$place_found = $this->Place->Read();

I have also tried doing this:

$this->Place->city = blah;
$this->Place->area = foo; etc....

$place_found = $this->Place->read();

However, that also does not work.

  • 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-27T05:06:57+00:00Added an answer on May 27, 2026 at 5:06 am

    Haven’t you ever used find()?! read() only fetches a row with the ID passed.

    $place_found = $this->Place->find('first', array(
        'conditions' => array(
              'Place.city' => $city,
              'Place.area' => $area
              // etc
         )
    ));
    

    If you need to build the conditions manually you can create a conditions array to pass like so:

    $placeConditions = array();
    $placeConditions['city'] = $city;
    if($area) {
        $placeConditions['area'] = $area;
    }
    
    $places = $this->Place->find('first', array('conditions' => $placeConditions));
    

    I suggest you read the page I linked, you will soon find out there is never a reason to use the read() method.

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

Sidebar

Related Questions

After constructing the bean, I want to retrieve data from the database, using the
I want to know is this practically possible in sql(using php as server-side), where
Does anyone know if something like this is possible? Do a quick search, using
I want to know if it's possible to register a type library without using
I want to know if it is possible to stream data from the server
So what I want to know is whether the following is possible. I have
I want to know is it possible to retrieve existing hbase table's schema ?
I don't know if what I want is possible, but is this: Suppose I
I want to implement a generic method to retrieve header/detail data from a database:
I want to know if it is possible to retrieve a user's friend's photo

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.