I have searched several times but I have not found a solution, I need to display an image that was saved as BLOB in the database.
Part of the code that saves to the database and displays the data
function manage_report($param1 = '', $param2 = '', $param3 = '')
{
if ($this->session->userdata('doctor_login') != 1)
redirect(base_url() . 'index.php?login', 'refresh');
if ($param1 == 'create') {
$data['img_principal'] = $this->input->post('img_principal');
$this->db->insert('report', $data);
$this->session->set_flashdata('flash_message', get_phrase('report_created'));
redirect(base_url() . 'index.php?doctor/manage_report', 'refresh');
}
if ($param1 == 'edit' && $param2 == 'do_update') {
$data['img_principal'] = $this->input->post('img_principal');
$this->db->where('report_id', $param3);
$this->db->update('report', $data);
$this->session->set_flashdata('flash_message', get_phrase('account_updated'));
redirect(base_url() . 'index.php?doctor/manage_report', 'refresh');
} else if ($param1 == 'edit') {
$page_data['edit_profile'] = $this->db->get_where('report', array(
'report_id' => $param2
))->result_array();
}
$page_data['page_name'] = 'manage_report';
$page_data['page_title'] = get_phrase('manage_report');
$page_data['reports'] = $this->db->get('report')->result_array();
$this->load->view('index', $page_data);
}
As I'm trying to show on the .html page
<img src="<?php echo $row['img_principal']; ?>"/>
database
CREATE TABLE 'report' ( 'report_id' int(11) NOT NULL, 'img_principal' blo NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;