douju2599
2014-03-12 03:28
浏览 29
已采纳

Yii:用于显示数据库中所有信息的代码

I am really new to YII framework so bear with me guys. =) here's my code.

    public function actionList()
{
$Employee = new employee;

$data = array('employee' => $Employee);
$this->render('Employee_Display', $data);
}



        <tbody>
    <tr>
        <?php foreach($employee as $row): ?>
        <td><?php $row['employee_firstname']; ?></td>
        <?php endforeach; ?>

    </tr>
</tbody>

I want to get the list of employees names and display it on a tabular form.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dongyao5186 2014-03-12 03:48
    最佳回答
       public function actionList()
        {
          $Employee = employee::model()->findAll();
          $data = array('employee' => $Employee);
          $this->render('Employee_Display', $data);
        }
            <tbody>
        <tr>
            <?php foreach($employee as $row): ?>
            <td><?php $row->employee_firstname; ?></td>
            <?php endforeach; ?>
    
        </tr>
    </tbody>
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题