CodeIgniter Forums

Full Version: best way to set concat in codeigniter?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I have problem with CONCAT function in mysql.

this is my code

PHP Code:
  function genitpsID()

      $itps_insert_id $this->db->insert_id();

      $itps "ITPS";
      $myquery "CONCAT('$itps','LPAD('$itps_insert_id', 3, '0'))";
      if ($this->db->trans_status() === TRUE)
        return false;

I can't set concat in codeigniter.. the output is will like this 
PHP Code:
CONCAT('ITPS','LPAD('6', 3, '0'))  

My reference..
Please help me.. Sad
$myquery = "CONCAT($itps, LPAD($itps_insert_id, 3, 0))";
$myquery = "CONCAT('" . $itps . "', LPAD('" . $itps_insert_id . "', 3, 0))";