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'; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter