I am new to ZF2, and I am trying to delete a data to database, but data can't delete , error Statement could not be executed (42S22 - 1054 - Unknown column '' in 'field list')
my view
<?php foreach ($this->list as $data): ?>
<tr>
<td>
<?php echo $data->id ?>
</td>
<a href="<?php echo $this->url('mif',array('action'=>'delete', 'id' => $data->id));?>">Delete</a>
my controller
public function deleteAction()
{
$request = $this->getRequest();
$post = (int) $this->params()->fromRoute('id', null);
$storage = MiffModel\Storage::factory($this->getDb(), $this->getConfig());
$user = new MiffModel($storage);
$del = $user->del($post);
if($del){
$success = true;
$msg = 'Data sudah dihapus.';
}else{
$success = false;
$msg = 'gagal.';
}
$view = new ViewModel();
$view->setTemplate('mif/index');
my model
public function del($post){
$delete = "DELETE from test where id = $post";
$db = $this->_db;
$result = $this->_db->query($delete, $db::QUERY_MODE_EXECUTE);
return $result;
}
}