title: In codeigniter how to remove unwanted characters or symbols in string
body: <p>When i run csv  import using codeigniter  php i stuck with this mysql error </p>
  
  <p><a href="https://i.stack.imgur.com/4GJUi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4GJUi.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>Reason for this error is that unwanted characters or symbols in the string.</p>
  </blockquote>
  
  <p>This is the CodeIgniter code I use.</p>
  
  <pre><code>$this-&gt;db-&gt;where('designationName', $row[$ex_start + 3]);
  $q = $this-&gt;db-&gt;get('designation');
  if ($q-&gt;result()) {
  $id = $q-&gt;result_array();
      $designation = $id[0]['iddesignation'];
  
  } else {
      $data = array(
          'designationName' =&gt; $row[$ex_start + 3], //this is the variable that get string 
          'designationDate' =&gt; date('Y-m-d'),
          'status_idstatus' =&gt; '1'
      );
      $this-&gt;db-&gt;insert('designation', $data); //this is the point that error occurs
      $designation = $this-&gt;db-&gt;insert_id();
  
  }
  </code></pre>
  
  <p><strong>How I avoid this kind of characters or symbols ?</strong></p>