Hi I have been working on this code and for almost a day i just can't remove the error i have checked the internet but for somehow i wasn't able to find the solution i was looking for kindly help me with this thankyou very much Here is the code
Controller
public function show() {
$data['results']= $this->User_model->get_users();
$this->load->view('delete_view', $data);
Model
public function get_users($id){
$this->db->where('id', $id);
$query = $this->db->get('users');
return $query->result();
View
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
foreach ($results as $show){
echo $show->username;
}
?>
</body>
</html>
You passed a parameter in your model through where condition. unfortunately you didn't pass it through your controller. As your controller method, your model should be look like this.
public function get_users(){
$this->db->select('*');
$query = $this->db->get('users');
return $query->result();
}