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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:42:28+00:00 2026-05-14T02:42:28+00:00

I have a simple database with multiple tables. I can’t figure out how to

  • 0

I have a simple database with multiple tables. I can’t figure out how to make cakePHP display the values associated with a foreign key in an index view. Or create a view where the fields of my choice (the ones that make sense to users like location name – not location_id can be updated or viewed on a single page).

I have created an example at http://lovecats.cakeapp.com that illustrate the question. If you look at the page and click the “list cats”, you will notice that it shows the location_id field from the locations table. You will also notice that when you click “add cats”, you must choose a location_id from the locations table. This is the automagic way that cakePHP builds the app. I want this to be the field location_name.

alt text

The database is setup so that the table cats has a foreign key called location_id that has a relationship to a table called locations.

This is my problem: I want these pages to display the location_name instead of the location_id. If you want to login to the application, you can go to http://cakeapp.com/sqldesigners/sql/lovecats and the password ‘password’ to look at the db relationships, etc.

How do I have a page that shows the fields that I want? And is it possible to create a page that updates fields from all of the tables at once?

This is the slice of cake that I have been trying to figure out and this would REALLY get me over a hump. You can download the app and sql from the above url.

  • 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-14T02:42:29+00:00Added an answer on May 14, 2026 at 2:42 am

    Hah, you figured it out correctly! Cake uses the $displayField variable do decide what to..well, display.

    If I remember correctly, by default, cake looks for ‘title’ and ‘name’ fields, and if those two are not available, it will simply show your primary key field. Luckily, you can override it the way you figured out yourself 😉

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

Sidebar

Related Questions

I'm trying to set up a simple SQLite database in Android, handling the schema
I have a database and I've created a DBML Linq-to-SQL file to represent this
I'm wondering if there are any applications, preferably freeware, that can take a database
I have this GUI that shows, let's say Customer Orders. When my client nailed
I have a Collection on Menu Sections which each contain a collection of Menu
I have an application that needs to support a multilingual interface, five languages to
We are running a PHP (zend framework) app that creates a database per user
I am trying to write some integration tests for some SQL server stored procedures
Beyond work, some friends and I are trying to build a game of sorts;

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.