Codeigniter Active Record: Insert, Select, Update, Delete

PHOTO EMBED

Tue Jun 14 2022 07:11:41 GMT+0000 (Coordinated Universal Time)

Saved by @codespare

public function index() {
        $query = $this->db->get('orders');
        
        echo "<h3>Orders Listing</h3>";
        echo "<ul>";
        
        foreach ($query->result() as $row) {
            echo "<li>$row->customer_name</li>";
        }
        
        echo "</ul>";
    }




public function update_order() {
        $data = [
            'customer_name' => 'Joe',
        ];
        $this->db->where('id', 1);
        $this->db->update('orders', $data);
        echo 'order has successfully been updated';
    }
content_copyCOPY

https://www.guru99.com/codeigniter-active-record.html