CodeIgniter Forums

Full Version: Using MySQL blobs -- CI vs php mysql functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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!