Welcome Guest, Not a member yet? Register   Sign In
Update two joined tables
#7

[eluser]Thorpe Obazee[/eluser]
Code:
// Users table.
        $userdata = array('username' => $username,
                      'email' => $email,
                      'status' => $status);

        $this->db->where('id', $id);
        $this->db->join('meta', 'meta.id = users.id', 'left');
        $this->db->update('users', $userdata);
        
    // Meta table.
    // Mod
       $affected_rows1 = $this->db->affected_rows() ? TRUE : FALSE;
  
        $metadata = array('first_name' => $first_name,
                      'last_name' => $last_name,
                      'my_feeds' => $my_feeds);

        $this->db->where('user_id', $id);
        $this->db->update('meta', $metadata);
         /**/
       // Mod
        $affected_rows2 = $this->db->affected_rows() ? TRUE : FALSE;

      // Mod
        return ($affected_rows1 AND  $affected_rows2) ? TRUE : FALSE;


Messages In This Thread
Update two joined tables - by El Forum - 11-13-2008, 02:58 PM
Update two joined tables - by El Forum - 11-13-2008, 03:14 PM
Update two joined tables - by El Forum - 11-13-2008, 03:26 PM
Update two joined tables - by El Forum - 07-14-2009, 10:45 PM
Update two joined tables - by El Forum - 07-15-2009, 12:00 AM
Update two joined tables - by El Forum - 07-15-2009, 12:24 AM
Update two joined tables - by El Forum - 07-15-2009, 12:43 AM
Update two joined tables - by El Forum - 07-15-2009, 12:52 AM
Update two joined tables - by El Forum - 08-13-2009, 12:33 PM
Update two joined tables - by El Forum - 08-13-2009, 12:40 PM
Update two joined tables - by El Forum - 08-13-2009, 12:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB