• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQL functions on DB class

#1
Hello,

Is there a way to run SQL function with the CI db class?(ie: COMPRESS(?))

In slim framework I'm using it in this way:


PHP Code:
$data = array(
       "userid" => $userid,
      "data" => $this->db->func('COMPRESS(?)', [json_encode($data)]),
);

 $db_insert $this->db->insert("products"$data); 

Is there something similar in CI?

Thanks! Smile
Reply

#2
An update:
Ended up with converting the insert to query binds. Hopefully it'll help someone in the future.
Reply

#3
Depending on the version of CI you are using this might help you out: https://codeigniter.com/user_guide/datab...ction.html
Reply

#4
Maybe:


PHP Code:
$this->db->query('COMPRESS(?)'data); 
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.