在 codeigniter 中一起更新和连接查询?

Him*_*yal 5 php mysql codeigniter

在连接两个表的同时更新数据,但它给出了一个错误,说明我可以在查询中一起使用连接和更新的条件吗?

这是我的代码

public function update_model($id,array $data)
{

//$textArea=$data['textdata'];
$this->db->join('user_data', 'user.id = user_data.id');
$this->db>where('user_data.id',$id);
$this->db->update('user_data',$data);

$query=$this->db->get();
return $query->result();
}
Run Code Online (Sandbox Code Playgroud)

我的 mysql 中出现如下错误

致命错误:未捕获错误:调用 C:\xampp\htdocs\P_Display\application\models\Pmodel.php:103 中未定义的函数 where() 堆栈跟踪:#0 C:\xampp\htdocs\P_Display\application\controllers\ user.php(1??24): Pmodel->update_model('1', Array) #1 C:\xampp\htdocs\P_Display\system\core\CodeIgniter.php(360): User->updateSave('1 ') #2 C:\xampp\htdocs\P_Display\index.php(202): require_once('C:\xampp\htdocs...') #3 {main} 抛出到 C:\xampp\htdocs\P_Display\ application\models\Pmodel.php 在第 103 行

where 子句给了我一个错误,使用这个查询是否正确?

Him*_*yal 4

Thanks @HekMet for your reply

now i got the code but in a different way lok at it and let me know if you found some problem with it..

 public function update_model($id,array $data)
{
$uname=$data['uname'];
$email=$data['email'];
$password=$data['password'];
$address=$data['address'];
$mobilenumber=$data['Mobilenumber'];
$job=$data['Job'];

$query=
$this->db->set('user_data.email',$email);
$this->db->set('user.password',$password);
$this->db->set('user_data.mobilenumber',$mobilenumber);
$this->db->set('user_data.job',$job);
$this->db->set('user.uname',$uname);

$this->db->where('user_data.id',$id);
$this->db->where('user.id',$id);
$this->db->update('user_data JOIN user ON user_data.id= user.id');


return $query;


}
Run Code Online (Sandbox Code Playgroud)

since it was giving error that my variable are ambigious i need to just set their values separatly.