Cgridview With Data From Two Tables

Two tables BillDetails and Attachments. Each entry in BillDetails may have multiple attachments. I need to display the BillDetails data with Attachments as link in a gridview. That is the gridview need to have columns Amount, Description and Attachments.

Am new to php and yii…

In gridview call the model function

<?php $this->widget('zii.widgets.grid.CGridView', array(











)); ?>

model will check the current record with relation table and display the attachment link


	public function attachmentlink(){

		//$this->attachment is a relation name


			echo "<ul>";

			foreach($this->attachment as $attachment){

				echo "<li><a href=".$attachment->path.">".$attachment->name."</a></li>";


			echo "</ul>";


			echo "No Attachments";



Thank you… This worked for me…