title: How to create rows of tables using loop in PHP
body: <p>I have been trying to create rows in a table in Yii using PHP but somehow I am not able to do that. I have attached the code below.</p>
  
  <p><strong>PHP</strong> code:  </p>
  
  <pre><code>&lt;div class="grid_16"&gt;
  &lt;table style="width:100%"&gt;
  &lt;tr&gt;
  &lt;th style="width:33%;" id="wall_userNameStyle"&gt;&lt;?php echo CHtml::activeLabel($Facility,'cname'); ?&gt;&lt;/th&gt;
  &lt;th style="width:33%;margin:0 0.5%" id="wall_userNameStyle"&gt;&lt;?php echo CHtml::activeLabel($Facility,'cregistration'); ?&gt;&lt;/th&gt;
  &lt;th style="width:33%" id="wall_userNameStyle"&gt;&lt;?php echo CHtml::activeLabel($Facility,'cannual'); ?&gt;&lt;/th&gt;
  &lt;/tr&gt;
  
  &lt;?php $j=0;
  for($j; $j&lt;5; $j++)
  {
  ?&gt;
  &lt;tr&gt;
  &lt;td style="width:33%;"&gt;&lt;?php echo CHtml::activeTextField($Facility,"raymond[$j][0]",array('class' =&gt; 'edit_textbox','style' =&gt; 'width:99%')) ; ?&gt;&lt;/td&gt; 
  
  &lt;td style="width:33%;margin:0 0.5%"&gt;&lt;?php echo CHtml::activeTextField($Facility,"raymond[$j][1]",array('class' =&gt; 'edit_textbox','onkeypress'=&gt;'return number_only(event)','style' =&gt; 'width:99%')) ; ?&gt;&lt;/td&gt; 
  
  &lt;td style="width:33%;"&gt;&lt;?php echo CHtml::activeTextField($Facility,"raymond[$j][2]",array('class' =&gt; 'edit_textbox','onkeypress'=&gt;'return number_only(event)','style' =&gt; 'width:99%')) ; ?&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;?php } ?&gt;
  &lt;/div&gt;
  </code></pre>