title: Using insert query CI PHP Mysql Ajax
body: <p>Iam new on using Code Igniter. I want to use a custom insert query, reason is i want to use uuid() on my query and Im not sure what part of my code is wrong. I echoed the query, it seems that the custom query is correct, I tried it executing directly on my phpmyadmin. Please help me. TIA!</p>
  
  <p>SSL.js</p>
  
  <pre><code>$('#btnSaveSSL').click(function(){
      var SelMerch = $('#merchantList option:selected').val();
      var SSLCert = $('#SSLCert').val();
      var SSLPath = $('#file_SSL').val();
      var ReqDate = $('#ReqDate').val();
      var ExpDate = $('#ExpDate').val();
      var Requester = $('#Requester').val();
      $.ajax({
          type:"post",
          url: baseurl + "SSLController/AddSSLRecord",
          data: {'SelMerch': SelMerch,
                  'SSLCert': SSLCert,
                  'SSLPath': SSLPath,
                  'ReqDate': ReqDate,
                  'ExpDate': ExpDate,
                  'Requester': Requester},
          success:function(response) 
          {
              alert(response);
          },
          error: function(response) 
          {
              console.log(response.d);
          }
      });
  });
  </code></pre>
  
  <p>SSLController.php</p>
  
  <pre><code>function AddSSLRecord(){
      $SelMerch = $this-&gt;input-&gt;post('SelMerch');
      $SSLCert = $this-&gt;input-&gt;post('SSLCert');
      $SSLPath = $this-&gt;input-&gt;post('SSLPath');
      $ReqDate = $this-&gt;input-&gt;post('ReqDate');
      $ExpDate = $this-&gt;input-&gt;post('ExpDate');
      $Requester = $this-&gt;input-&gt;post('Requester');
      $sql = 'INSERT INTO tbl_user(SSLID,
                                  MerchantID,
                                  SSL_CertName,
                                  SSL_CertPath,
                                  RequestDate,
                                  ExpirationDate,
                                  Requester)  
              VALUES (    uuid()
                       ,' .$this-&gt;db-&gt;escape($SelMerch).
                      ','.$this-&gt;db-&gt;escape($SSLCert).
                      ','.$this-&gt;db-&gt;escape($SSLPath).
                      ','.$this-&gt;db-&gt;escape($ReqDate).
                      ','.$this-&gt;db-&gt;escape($ExpDate).
                      ','.$this-&gt;db-&gt;escape($Requester).')';
       $this-&gt;SSLModel-&gt;CreateSSLRecord($sql);
  
      // echo "success" . $sql;
  }
  </code></pre>
  
  <p>SSLModel.php</p>
  
  <pre><code>public function __construct() {
          parent::__construct();
          $this-&gt;load-&gt;database();
      }
  function CreateSSLRecord($sql){
          $this-&gt;db-&gt;insert("tbl_ssl", $sql);  
      }
  </code></pre>