title: codeigniter $this->save() not working
body: <p>I recently started using codeigniter. trying to create a new model for a new table. It seems save() method is not working properly. I am not able to see new records in my table.I did some research over net and stackoverflow, but no use. Can someone please check my code and advice. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    2 
    3 class Listing_Price_History extends DataMapper
    4 {
    5 
    6     var $table = 'listing_price_history';
    7     var $primary_key = 'id';
    8     var $primary_key_suffix = '_uid';
    9 
   10 
   11     // --------------------------------------------------------------------
   12         /** Validations for the requried fields */
   13     var $validation = array(
   14         'listing_id' =&gt; array(
   15                 'label' =&gt; 'Listing Id',
   16                 'rules' =&gt; array('required')
   17         ),
   18         'price_per_sqft' =&gt; array(
   19                 'label' =&gt; 'Price per square feet',
   20                 'rules' =&gt; array('required')
   21         )
   22     );
   23 
   24     // --------------------------------------------------------------------
   25 
   26     public function __construct() {
   27         parent::__construct();
   28         $CI =&amp; get_instance();
   29         $CI-&gt;load-&gt;library('uuid');
   30         $this-&gt;uuid = $CI-&gt;uuid;
   31         $CI-&gt;load-&gt;helper('company');
   32 
   33     }
   34 
   35     // --------------------------------------------------------------------
   36 
   37     // --------------------------------------------------------------------
   38 
   39     /**
   40      * Create listing entry
  41      *
   42      * @return bool
   43      **/
   44     public function savePriceHistory($history) {
   45           //  var_dump($history); 
   46           //  var_dump($this);
   47             if(isset($history['listing_id']))
   48               $this-&gt;listing_id = $history['listing_id'];
   49             if(isset($history['price_per_sqft']))
   50               $this-&gt;price_per_sqft = $history['price_per_sqft'];
   51             $date = date('Y-m-d H:i:s');
   52             $this-&gt;created_by = $this-&gt;uuid;
   53             $this-&gt;created_date = $date;
   54             $save_history = $this-&gt;save();
   55           //  var_dump($this-&gt;check_last_query());
   56           //  var_dump($this-&gt;db-&gt;_error_message());
   57           //  var_dump($this-&gt;db-&gt;_error_number());
   58           //  var_dump($save_history);
   59     }
   60 }
                                                                                                                                60,1          Bot</code></pre>
  </div>
  </div>
  </p>
  
  <p>Controller: 
  This is how I am calling model </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> 432             if($status){
   433               echo "Entered";
   434               $price_history = new Listing_Price_History();
   435               $save_history =  $price_history-&gt;savePriceHistory($history);
   436               echo $save_history;
   437               echo "Finished";
   438             }</code></pre>
  </div>
  </div>
  </p>
  
  <p>this is my table structure</p>
  
  <p><a href="https://i.stack.imgur.com/aE82q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aE82q.png" alt="enter image description here"></a></p>
  
  <p>please let me know where I am doing wrong. </p>