Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CakePHP:如何从外部表查看详细信息?_Cakephp - Fatal编程技术网

CakePHP:如何从外部表查看详细信息?

CakePHP:如何从外部表查看详细信息?,cakephp,Cakephp,我有两种模式:会员模式和职业模式。它们的结构如下: MEMBER member_id last_name first_name vocation_id (foreign key) VOCATION vocation_id description 在会员的查看页面中,我想显示会员的姓、名和职业描述。我似乎在文档中找不到它 我尝试了基本的CakePHP查看,但它只返回职业ID。我猜我需要在我的MembersController中创建一个新函数来查找他拥有的职业详细信息。我只需要关于如何做的标准。

我有两种模式:会员模式和职业模式。它们的结构如下:

MEMBER
member_id
last_name
first_name
vocation_id (foreign key)

VOCATION
vocation_id
description
在会员的查看页面中,我想显示会员的姓、名和职业描述。我似乎在文档中找不到它

我尝试了基本的CakePHP查看,但它只返回职业ID。我猜我需要在我的MembersController中创建一个新函数来查找他拥有的职业详细信息。我只需要关于如何做的标准。我将在文档中查看更多内容。也许我只是错过了一些东西。如果我找到答案,我会更新这个问题。现在,以下是我当前的代码:

<h1>#<?php echo h($member['Member']['member_id']); ?></h1>
<table>
    <tr>
        <td>Last Name</td>
        <td><?php echo $member['Member']['last_name']; ?></td>
    </tr>
    <tr>
        <td>First Name</td>
        <td><?php echo $member['Member']['first_name']; ?></td>
    </tr>
    <tr>
        <td>Vocation</td>
        <td><?php echo $member['Member']['vocation_id']; ?></td>
    </tr>
</table>
#
姓
名字
职业

职业
职业描述

到目前为止,您尝试了什么?你的具体问题是什么?以当前的方式问,听起来你希望有人为你编写代码,这不是StackOverflow的目的。@Dave我编辑了我的问题,添加了我到目前为止尝试过的内容。感谢您的建设性评论。作为对此类问题的一般提示,您可以在视图中使用
var\u dump($member)
查看其键@乙酰胆碱酯酶。将来肯定会用到它。我会看看var_dump到底做了什么。谢谢你!
<tr>
    <td>Vocation</td>
    <td><?php echo $member['Vocation']['vocation_id']; ?></td>
</tr>
<tr>
    <td>Vocation description</td>
    <td><?php echo $member['Vocation']['description']; ?></td>
</tr>