Hi Guys

Please have a look at my model and then read below

    public function get_events(){
        $query = $this->db->get('events',1, 1);
        return $query->result_array();

Okay so when i run the page i only get my message that no entry's are in the table! So when i insert a entry it displays the same message saying there are no entry's in the table but when i insert a second entry it works fine.

what im trying to achieve is quite simple i just want to limit the output of my table to the latest entry and only display one entry in the box.

Please could someone shed some light as to why this happens? My offset and limit are set to 1 as show above?

2 Years
Discussion Span
Last Post by Ventech_IT

Hi Bachov i fixed the problem by adding the following line denoted with the arrow to my Model

    public function get_events(){
        $this->db->order_by("eventId", "desc"); <----
        $query = $this->db->get('events',1);
        return $query->result_array();

Thanks for the link made for some intersting reading

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.