@mallory_cormier
To get a list of users in CodeIgniter, you can follow these steps:
1 2 3 4 5 6 7 8 |
<?php
class User_model extends CI_Model {
public function get_users() {
$query = $this->db->get('users');
return $query->result();
}
}
|
1 2 3 4 5 6 7 8 9 10 |
<?php
class User extends CI_Controller {
public function index() {
$this->load->model('User_model');
$data['users'] = $this->User_model->get_users();
$this->load->view('users_list', $data);
}
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!DOCTYPE html>
<html>
<head>
<title>Users List</title>
</head>
<body>
<h1>Users List</h1>
<ul>
<?php foreach ($users as $user): ?>
<li><?php echo $user->name; ?></li>
<?php endforeach; ?>
</ul>
</body>
</html>
|
This is a simple example of how to get a list of users in CodeIgniter. You may need to modify the model, controller, and view based on your application requirements and database structure.