I have two tables where one attribute is foreign key. I want to display it without using any widgets(e.g CListView or CGridView)
The problem is how to show varchar instead of INT
what I’ve done in the views/name_folder/index.php is
<table id="box-table-a">
<thead>
<tr>
<th scope="col">No</th>
<th scope="col">Project</th>
<th scope="col">Contractor</th>
</tr>
</thead>
<tbody>
<tr>
<?php
foreach($projectDataProvider->data as $p):?>
<td><?php echo $p->id;?></td>
<td><?php echo $p->project_name;?></td>
<td><?php echo $p->contractor_id;?></td> //How to echo $p->contractor_name;
</tr>
<?php endforeach;?>
</tbody>
</table>
result is
No|Project |Contractor|
1 |Web Development| 1 |
2 |Web Design | 3 |
3 |Database Design| 2 |
what I want is
No|Project |Contractor|
1 |Web Development| Alex |
2 |Web Design | Buddy |
3 |Database Design| Charlie |
the problem is quite similar to this but in my case I don’t want to use any widgets, is that possible?