title: Yii How to foreach data from DB
body: <p>How yii foreach data from DB ?  One developer have multiple game, but when i call the data out from DB it only show one data</p>
  
  <p>Following is my coding :</p>
  
  <p><strong>In Controller</strong></p>
  
  <pre><code>$id = Yii::app()-&gt;user-&gt;getState('id');
  $thedb = GamesDevelopersApp::model()-&gt;find('developer_id='.$id);
  $gametitle     = CHtml::encode($thedb-&gt;gametitle);
  $version       = CHtml::encode($thedb-&gt;version);
  $create_time   = CHtml::encode($thedb-&gt;uploaddate);
  $status        = CHtml::encode($thedb-&gt;status);
  
  $this-&gt;render('applist',array('gametitle'=&gt;$gametitle,'version'=&gt;$version,'create_time'=&gt;$create_time,'status'=&gt;$status));
  </code></pre>
  
  <p><strong>In HTML</strong></p>
  
  <pre><code>    &lt;td class="apptd2"&gt;
          &lt;?php foreach($models as $model){
              echo CHTML::encode($model-&gt;gametitle);  
          }; ?&gt;
      &lt;/td&gt;
  </code></pre>