Hi
i want to display if possible a field from another table
table a has group_id linked to group table..in edit it shows me the group_id i want to display near it the libelle of groupe
i m just starting in cakephp
please fine the code

<div class="acnopens form">
<?php echo $this->Form->create('Acnopen'); ?>
    <fieldset>
        <legend><?php echo __('Edit Acnopen'); ?></legend>
    <?php

        echo $this->Form->input('acn_id');
        echo $this->Form->input('date');
        echo $this->Form->input('name');
        echo $this->Form->input('details');
        echo $this->Form->input('group_id');

        echo $this->Form->input('customer_id');
        echo $this->Form->input('cb');
    ?>
    </fieldset>
<?php echo $this->Form->end(__('Submit')); ?>
</div>
<div class="actions">
    <h3><?php echo __('Actions'); ?></h3>
    <ul>

        <li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('Acnopen.acn_id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('Acnopen.acn_id'))); ?> </li>
        <li><?php echo $this->Html->link(__('List Acnopens'), array('action' => 'index')); ?></li>
        <li><?php echo $this->Html->link(__('List Groups'), array('controller' => 'groups', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Group'), array('controller' => 'groups', 'action' => 'add')); ?> </li>
        <li><?php echo $this->Html->link(__('List Customers'), array('controller' => 'customers', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Customer'), array('controller' => 'customers', 'action' => 'add')); ?> </li>
    </ul>
</div>
Member Avatar for diafol

This makes little sense to me. Could you expand on your needs? Which other table? Which fields do you need? Are you talking about a JOIN in the query?

join table ...
when i edit my form to update i have name,address,type of job linked to job table..
name:XXXX
ADDRESS:YYYY
type of job =1 near it i want to put the libelle of 1 near it to make it more clear

Member Avatar for diafol

SO you want the job name instead of the job id:

SELECT u.name, u.address, j.libelle FROM users AS u LEFT JOIN jobs AS j ON u.job_id = j.job_id

That will give you all members, regardless of whether they have a job or not. If you only want users who have a job:

SELECT u.name, u.address, j.libelle FROM users AS u INNER JOIN jobs AS j ON u.job_id = j.job_id
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.