In codeigniter how to remove unwanted characters or symbols in string
you can do
$data = array( 'designationName' => preg_replace('/[^a-zA-Z0-9-_\.]/','', $row[$ex_start + 3]) 'designationDate' => date('Y-m-d'), 'status_idstatus' => '1');
Note: This will allow plain text+numbers to save. No, any special chars will pass
Edit 01
If you need to allow some special chars (all keyboard chars)
preg_replace('/[^A-Za-z0-9_~`\/@!$.%^#&*\\()+-=]/','', $row[$ex_start + 3])
Or you can use Escaping Queries in codeigniter
$this->db->escape()
$this->db->escape_str()
$this->db->escape_like_str()