Welcome Guest, Not a member yet? Register   Sign In
Caching db with result_array()
#1

[eluser]satie[/eluser]
Hi all,

If I try to cache a query that returns a result_array, CI doesn't return anything.
Cache in my controller:

Code:
$cacheID = 'product_img_' . $data['id'];
      if ( !$data['product_img'] = $this->cache->get($cacheID) ) {
        $data['product_img'] = $this->m_epp->product_img($data);
        $this->cache->save($cacheID, $data['product_img'], 900);
      }

var_dump($data['product_img']) without cache returns:


object(CI_DB_mysql_result)#34 (8) { ["conn_id"]=> int(0) ["result_id"]=> int(0) ["result_array"]=> array(0) { } ["result_object"]=> array(0) { } ["custom_result_object"]=> array(0) { } ["current_row"]=> int(0) ["num_rows"]=> int(1) ["row_data"]=> NULL }


var_dump($data['product_img']) WITH cache returns:


object(CI_DB_mysql_result)#34 (8) { ["conn_id"]=> resource(35) of type (mysql link persistent) ["result_id"]=> resource(59) of type (mysql result) ["result_array"]=> array(0) { } ["result_object"]=> array(0) { } ["custom_result_object"]=> array(0) { } ["current_row"]=> int(0) ["num_rows"]=> int(1) ["row_data"]=> NULL }

Is there a problem with result_array() ?
Thanks for your help.





Theme © iAndrew 2016 - Forum software by © MyBB