[eluser]ede196620[/eluser]
Hi everyone i am trying to add a delete function to my project where a row in a table is deleted when a button is clicked but fore some reason that my noob brain cant figure out i am getting an error.
here is the error:
Code:
Fatal error: Call to undefined method Display_model::delete_row() in C:\wamp\www\Surva\application\controllers\display.php on line 34
and here is the rest of my code :
CONTROLLER
Code:
function delete(){
$this->load->model('display_model');
$this->display_model->delete_row();
$this->index();
}
VIEW
Code:
<?php if(isset($queries)) : foreach($queries as $row): ?>
<tr>
<td> <?php echo $row->Question; ?></td>
<td> <?php echo $row->qA; ?> </td>
<td> <?php echo $row->qB; ?></td>
<td> <?php echo $row->qC; ?></td>
<td><?php echo anchor('display/edit','Edit'); ?></td>
<td><?php echo anchor('display/delete','Delete'); ?></td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<h1>No records created </h1>
<?php endif; ?>
</table>
<?php if (strlen($pagination)): ?>
<div>
Pages: <?php echo $pagination; ?>
</div>
<?php endif; ?>
<?php echo anchor('home', 'Back to Dashboard'); ?>
MODEL
Code:
function delete()
{
$this->db->where('QID', $this->url->segment(3));
$this->db->delete('tblquestions');
}