title: Postgres Decrypt in sql
body: <p>I am having a problem creating a libraries on codeigniter and postgres. My problem is that on my query on postgres I've encrypted the that is.</p>
  
  <pre><code>$sql = "INSERT table ('text') Values(encrypt('example','mysecret','aes'))
  </code></pre>
  
  <p>when querying to decrypt so I used this code</p>
  
  <pre><code>SELECT decrypt(text,'mysecret','aes') from table 
  </code></pre>
  
  <p>The displays on the query is okay, it decrypts but when going to foreach.</p>
  
  <pre><code>foreach($result as $key){
  echo $key-&gt;text;
  endforeach;
  </code></pre>
  
  <p>The results are encrypted, I wonder why what i did wrong.</p>