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

[eluser]spmckee[/eluser]
Thanks bargainph but when I do that I only get results for the last one executed.

For instance, if I update something in the second query I get a result. But if I update something in the first--and not in the second--the "affected_rows" returns none.

Here's what I have:
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.
  
        $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);
         /**/
        
        return ($this->db->affected_rows() > 0) ? 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