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?

Recommended Answers

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.