Re: HABTM view: how to retrieve data in extra column?

2010-02-04 Thread sebb86
John That's it. Thanks very much!!! :) Here is the complete code with columns, if needed: [code] sort(array('asc' =>'id v', 'desc' =>'id ^'), 'id'); ?> sort(array('asc' =>'forename v', 'desc' =>'forename ^'), 'forename'); ?> sort(array('asc' =>'sur

Re: HABTM view: how to retrieve data in extra column?

2010-02-03 Thread John Andersen
No, not that way, you have to use your existing code and use an inner loop, example: [code] <- your outer loop! Good! ... ... <- the inner loop! ... [/code] The outer loop gives you an array containing the 'staff' and the 'room' arrays. The inner loop takes the room array

Re: HABTM view: how to retrieve data in extra column?

2010-02-03 Thread sebb86
John Hello, i tryed: [code] , [/code] But with that code i get the following error-message: "Warning (2): Illegal offset type [APP\views\staffs\index.ctp, line 40]". Where is my fault? Thanks very much! Check out the new CakePHP Questions site http://cakeqs.org and hel

Re: HABTM view: how to retrieve data in extra column?

2010-02-03 Thread John Andersen
Do a foreach loop on the $staff['Room'] array in the table cell! Enjoy, John On Feb 3, 9:24 am, sebb86 wrote: > Hello, > in my database, there is a HABTM association between model "rooms" and > "staffs". > In my index-view of "staffs", when i retrieve the data, i'd like to > have an extra colu

HABTM view: how to retrieve data in extra column?

2010-02-03 Thread sebb86
Hello, in my database, there is a HABTM association between model "rooms" and "staffs". In my index-view of "staffs", when i retrieve the data, i'd like to have an extra column for each datarow with all rooms, which belongs to the current staff(id). The join table contains "room_id" and "staff_id"