This is not a Cake question, or really even a PHP question, but a general programming question. To not show the name when it’s the same as the previous row, remember the name from the previous row, compare against the current name, and only output it if it doesn’t match.
In case you need something like this you should investigate about colspan and rowspan.
In the student name td element you should add a rowspan attribute with the number of rows
that element should cover. Subsequent course name and grade result td’s should be on a new row.
bro you have to make two tables for this flow… one for students and second one for courses then set relationship between Student and Course & fetch with contain() method…
$students = $this->Students->find(‘all’)->contain(‘Course’);
this way is best for manage and relationship regarding the student and course. you can also make it more desirable… I just illustrate the work flow here.