How to do an update in the database on several tables related to codeigniter

3

I'm trying to do an update with codeigniter on two related tables, but I'm not getting it.

I'm using the following code.

    $this->db->set('p.page', $dados['page']);
    $this->db->set('c.title_map', $dados['title_map']);
    $this->db->where('p.id', $idpage);
    $this->db->where('c.pages_id', $idpage);
    $this->db->limit(1);
    $this->db->update('pages as p, customers as c', $dados, $condicao);

And I'm getting the following error.

    Ocorreu um erro de banco de dados

    Error Number: 1146
    Table 'newaircobraz.pages as p, customers' doesn't exist

    UPDATE 'pages as p, customers' as 'c' SET 'p'.'page' = 'OK Customers', 'c'.'title_map' = 'OK Click the red dots to view customers in each country.', 'id' = 'EN', 'page' = 'OK Customers', 'title_map' = 'OK Click the red dots to view customers in each country.' WHERE 'p'.'id' = '3' AND 'c'.'pages_id' = '3' AND 'id' = 'EN' LIMIT 1

    Filename: C:/xampp/htdocs/aircobraz/application/models/paginas_model.php
    Line Number: 75
    
asked by anonymous 17.07.2015 / 00:13

1 answer

2

Do one update at a time.

$this->db->update('pages',$dados,$condicao);

$this->db->update('customers',$dados,$condicao);
    
19.01.2016 / 00:30