class Item_model extends CI_Model { public function get_items() { $this->db->select('itemcode, itemname, image_html'); $this->db->from('items'); $query = $this->db->get(); return $query->result_array(); } public function extract_image_source($image_html) { // Use preg_match to extract the image source URL from the HTML code preg_match('/src="([^"]+)"/', $image_html, $matches); if (isset($matches[1])) { return $matches[1]; } return ""; } } class Items extends CI_Controller { public function index() { $this->load->model('Item_model'); $data['items'] = $this->Item_model->get_items(); $this->load->view('items_view', $data); } } Items Datatable

Items

Item Code Item Name Image
<?= $item['itemname'] ?>