My problem is pretty simple. I am using the active codeigniter entry, and the whole model class must do is select the very last item from the table owned by the user.
function get_progress($users_id)
{
$query = $this->db->get('progress');
$this->db->where('user_key', $users_id);
$this->db->order_by("id", "desc");
$this->db->limit(1);
return $query->row_array();
}
Seems simple, but for some reason, it captures the lowest id that matches user_key.
I tried changing the where statement to
$this->db->where('id', '2');
And it works, but of course it's just for troubleshooting. I need variables.
I rewrote several ways, including using get_where () and changing desc to asc. No matter what, he grabbed a low id. How can I choose the highest identifier, where user_key is the corresponding number.