Wednesday, January 29, 2014

simple Jquery in progress image

//start function
function  update_consignement_in_details() {

  $('#msg_div').html('<img width="20" height="20" src="'+CI.base_url+'images/b_loading.gif">');
  $('#msg_div').show();

  //function content


  $('#msg_div').css("color", "green"); 

  $('#msg_div').html('Cosignment-In updated successfully');
}

How to update a JOINed tables using Codeigniter's Active Record?

Codeigniter active record doesn't allow to update a joined tables. 
After trying various method and searching the solution, I have found the following solution which does the exactly same thing i.e. update the multiple join tables. By using following method, you can update multiple table using codeigniter active record.
$this->db->set('a.firstname', 'Pekka');
$this->db->set('a.lastname', 'Kuronen');
$this->db->set('b.companyname', 'Suomi Oy');
$this->db->set('b.companyaddress', 'Mannerheimtie 123, Helsinki Suomi');

$this->db->where('a.id', 1);
$this->db->where('a.id = b.id');
$this->db->update('table as a, table2 as b');