title: codeigniter database select comparing strings
body: <p>I'm trying to do a select in one of my models of my codeigniter project.
  I have used the method you will see next on some other functions and never had problems since i was comparing <code>int</code>s and not <code>string</code>s. However, now i'm comparing strings the select is not done correctly since it doesn't return any results.</p>
  
  <pre><code>public function get_frasesr_by_cee($ficha_id){
  
      $query = $this-&gt;db-&gt;query("SELECT * FROM tabela_cee_r where id_ficha='".$ficha_id."';");
  
      if ($query-&gt;num_rows() &gt; 0){
      //var_dump($query-&gt;result());
  
      $nomes_frasesr_cee;
      $i=0;
  
      foreach($query-&gt;result() as $row){
          $nomes_frasesr_cee[$i]=$row-&gt;cod_frase_r;
          //var_dump("Ola");
          $i++;
      }
  
      $max = sizeof($nomes_frasesr_cee);
      //var_dump($max);
      $dados_frasesr_cee;
  
      for($j = 0; $j &lt; $max;$j++)
      {
          var_dump($nomes_frasesr_cee[$j]);
          $query1 = $this-&gt;db-&gt;query("SELECT * FROM frases_r where cod_frase_r='".$nomes_frasesr_cee[$j]."';");
          //var_dump($query1-&gt;result());
          foreach($query1-&gt;result() as $value){
                  $dados_frasesr_cee[$j][0]=$value-&gt;id_frase_r;
                  $dados_frasesr_cee[$j][1]=$value-&gt;cod_frase_r;
                  $dados_frasesr_cee[$j][2]=$value-&gt;desc_frase_r;
                  $dados_frasesr_cee[$j][3]=$value-&gt;desc_frase_r_ing;
                  $dados_frasesr_cee[$j][4]=$value-&gt;desc_frase_r_esp;
                  $dados_frasesr_cee[$j][5]=$value-&gt;diretiva_frase_r;
          }
      }
      var_dump($dados_frasesr_cee);
      return $dados_frasesr_cee;
  
  } else {
          return;
      }
  
  }
  </code></pre>
  
  <p>I guess the select considers this var <code>$nomes_frasesr_cee[$j]</code> empty and she is not. If I replace the var directly by some string I have on database it works perfectly, so I don't get what is the problem with the var.</p>
  
  <p>Any hints? Thank you!</p>
  
  <p>Result of the var_dump($query1);</p>
  
  <pre><code>object(CI_DB_mysql_result)#21 (8) { ["conn_id"]=&gt; resource(29) of type (mysql link persistent) ["result_id"]=&gt; resource(43) of type (mysql result) ["result_array"]=&gt; array(0) { } ["result_object"]=&gt; array(0) { } ["custom_result_object"]=&gt; array(0) { } ["current_row"]=&gt; int(0) ["num_rows"]=&gt; int(0) ["row_data"]=&gt; NULL }
  </code></pre>