Note that there are some explanatory texts on larger screens.

plurals
  1. POCakePHP - Display another list record inside in listed record
    primarykey
    data
    text
    <p><code>How</code> can we <code>display</code> another list record <code>inside</code> in listed record using CakePHP?</p> <p>I have 3 table that consist: (staff,course,attendance)</p> <p>(Staff)</p> <pre><code>staff_id | name | passport ------------------------------------------------ 1 | A | 123 2 | B | 132 3 | C | 321 </code></pre> <p>(Course)</p> <pre><code>c_id | name ---------------------- 10 | PHP 20 | AJAX 30 | XHTML </code></pre> <p>(Attendance)</p> <pre><code>at_id | staff_id | course_id ------------------------------------------------ 1 | 1 | 10 2 | 1 | 20 3 | 1 | 30 4 | 2 | 20 5 | 2 | 30 </code></pre> <p>I would like to generate some report to display listed of course that attend by our staff as you can see below:</p> <pre><code>Name | Course Attend ------------------------------ A | PHP | AJAX | XHTML B | AJAX | XHTML </code></pre> <p>Here I use table staff in displaying result and what should I do to get some another fetch result in my column <code>Course Attend</code> that related to attendance table which will be listed all the related result to their staff ids.</p> <p>My Code:</p> <p>(ReportController.php)</p> <pre><code>$view = $this-&gt;Staff-&gt;find('all'); $this-&gt;set('view', $view); </code></pre> <p>(View - report.ctp)</p> <pre><code>&lt;table&gt; &lt;?php foreach($view as $data): ?&gt; &lt;td&gt; &lt;?php echo $data['Staff']['name']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php // something to do here... ?&gt; &lt;/td&gt; &lt;?php endforeach ?&gt; &lt;/table&gt; </code></pre> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload