i'm passing search variable as array to view file where i'm populating description a column from database how would i highlight certain search keywords in my description on view page.
// as my searched keywords are "mobiles in android".
//my returned description row is as // "There are hundreds of mobiles in android."
// how to highlight mobiles and android.
// which are returned from data base what to do with $row['desc'] preg_replace, str_replace tried, imploded the words tried, i replace tried problem not solved.
My Model:
public function anything($tbl){
$this->db->select('*');
$this->db->from($tbl);
$query = $this->db->get();
return $query->result_array();
}
My controller :
$search = $this->input->get('search');
$tbl = table;
$data['search'] = $this->my_model->search($tbl, $search); //returned query
$this->load->view('search-view', $data);
View File
foreach ($search as $row) {
echo = $row['desc'];
}