What is your Model relation for User and Translate? is it like this?

function User extends AppModel {
var $name = 'User';
var $hasMany = array('Translate');
}

and

function User extends AppModel {
var $name = 'User';
var $belongsTo = array('User');
 }

also post your view controller action.

have you tried the behavior Traslate in cake?

On Sat, Feb 21, 2009 at 3:46 PM, amarradi <[email protected]> wrote:

>
> Hello together,
>
> i've an Problem
>
> I have an Database with 2 Tables
>
> on table called translates and one table called users
>
> so a user can add many translations und a Translation can only be add
> from one user.
>
> How do i connect the Tables
>
> my translates has a field user_id as forgeign key
>
> the add is correct the user_id will be added in the translates Table
> but how can i change the view to read the username not the user_id
>
> Example after adding an word:
>
> germanword | englischword | created | modfied | user_id
>
> gehen | go | <datetime> | <datetime> | 8
>
> my view
>
> ?php foreach ($results as $translate): ?>
>    <tr>
>        <td><?php echo $translate['Translate']['germanword']; ?></td>
>        <td><?php echo $translate['Translate']['englishword']; ?></td>
>        <td><?php echo $translate['Translate']['created']; ?></td>
>        <td><?php echo $html->link('Übersetzung korrigieren', array
> ('action'=>'edit', $translate['Translate']['id']));?></td>
>        <td><?php echo $translate['User']['user_id'];?></td>
>    </tr>
> <?php endforeach; ?>
>
> Whats wrong here?
> The Error in the last colum is
> Undefined index:  User [APP/views/translates/search.ctp, line 49]
>
> 49: <td><?php echo $translate['User']['user_id'];?></td>
>
> many greetings
>
> Marcus Radisch
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to