CodeIgniter Forums
Using MySQL blobs -- CI vs php mysql functions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Using MySQL blobs -- CI vs php mysql functions (/showthread.php?tid=2849)



Using MySQL blobs -- CI vs php mysql functions - El Forum - 08-28-2007

[eluser]fMertins[/eluser]
Hi,

I´m saving blobs in MySQL, and I´m afraid that doesn´t works when using the database class from CI. I´ve made one example using CI methods and other example using MySQL php functions, here are the files:

BLOB ok
BLOB not ok

It seems CI database do a kind of convertion or translation characters...

Here is the code from BLOB ok
Code:
public function upd(Categoria $cate) {
      $upd = "update categoria set imagem_barrinha = '" . $cate->imagemBarrinha . "' where codcategoria = " . $cate->codCategoria;
      $bdok = mysql_query($upd);
      
      $dbMysql = mysql_connect("127.0.0.1", "root", "...");
      mysql_select_db("benklin", $dbMysql);
  
      if (!$bdok) {
         die("Erro ao alterar cliente. Comando SQL: " . $update);
      }
   }

And here is the code from BLOB not ok
Code:
public function upd(Categoria $cate) {
      $dados = array(
      "imagem_barrinha" => $cate->imagemBarrinha,
      );
      
      $this->db->where("codcategoria", $cate->codCategoria);
      $this->db->update("categoria", $dados);
   }

I´m missing something when using CI database, or doing something wrong?
Thanks!