this is the code of action
public function listAction()
{
$params = array('host' =>'localhost',
'username' =>'root',
'password' =>'mysql',
'dbname' =>'zf'
);
$DB = new Zend_Db_Adapter_Pdo_Mysql($params);
$DB->setFetchMode(Zend_Db::FETCH_OBJ);
$sql = "SELECT * FROM user ORDER BY user_name ASC";
$result = $DB->fetchAssoc($sql);
$this->view->assign('title','Member List');
$this->view->assign('description','Below, our members:');
$this->view->assign('datas',$result);
}
this is the code for the view
<table border="1">
<tr>
<th>ID</th>
<th>User Name</th>
<th>First Name</th>
<th>Last Name</th>
<th>Action</th>
</tr>
<? $datas = $this->datas;
for($i = 1; $i<= count($datas);$i++){ ?>
<tr>
<td><?=$datas[$i]['id']?></td>
<td><?=$datas[$i]['user_name']?></td>
<td><?=$datas[$i]['first_name']?></td>
<td><?=$datas[$i]['last_name']?></td>
<td>
<a href="edit/id/<?=$datas[$i]['id']?>">Edit</a>
|
<a href="del/id/<?=$datas[$i]['id']?>">Delete</a>
</td>
</tr>
<? } ?>
</table>
this is not working properly
please solve it thanks...