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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:20:29+00:00 2026-05-31T11:20:29+00:00

The data returned in the following format: in the controller [User] => Array (

  • 0

The data returned in the following format:

in the controller

[User] => Array
    (
        [first_name] => Vikas

        [last_name] => tyagi

        [phone_no] => 0234

        [mobile_no] => 0

        [location_id] => 1

        [state_id] => 2
    )

and i have table locations

           field      id        location_name

           value       1        chandigarh

i want to fire that query

select location_name from locations where location_id=1;

how can i do it in cake php

thanks in advance

  • 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-31T11:20:30+00:00Added an answer on May 31, 2026 at 11:20 am

    Two ways, one is simpler but more tedious, the other requires a setup but easier to use in the future.

    First way:

    $locationName = $this->Location->field('location_name', array('id' => $user['User']['location_id']));
    

    Second way:

    Setup a belongsTo relationship in your User model and hasOne in your Location model

    user.php:
    public $belongsTo = array('Location');
    
    location.php
    public $hasOne = array('User');
    

    This way, whenever you do a ->find() from your user model, the Location info would also be returned.

    http://book.cakephp.org/1.3/view/1041/hasOne

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

Sidebar

Related Questions

I have date data being returned from a server in the following format through
I have the following JSON data being returned, but for some reason, Javascript or
I have one main array which is the returned data from a MySQL query
I'm using JNI to obtain raw image data in the following format: The image
jQuery documentation indicates the following is returned: success(data, textStatus, XMLHttpRequest)Function A function to be
I'm very new to C#/LINQ/WP7 development and am struggling to format data being returned
I have the following data returned buy a simple SQL query. The Number of
I'm trying to parse some data returned by a 3rd party app (a TSV
How can I get the size in bytes of the data returned from the
I want to call a web page from Flash and use the data returned

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.