如何将数据更新到数据库中?没有错误,但是在我的数据库中没有更新
这是我的模特
public function updateNewServices($prod_name,$prod_id,$service_type,$service_gl_acc,$min_amnt,
$def_amnt,$max_amnt,$client,$services_id)
{
$services_id = $this->db->escape_str($services_id);
$prod_name = $this->db->escape_str($prod_name);
$prod_id = $this->db->escape_str($prod_id);
$service_type = $this->db->escape_str($service_type);
$service_gl_acc = $this->db->escape_str($service_gl_acc);
$min_amnt = $this->db->escape_str($min_amnt);
$def_amnt = $this->db->escape_str($def_amnt);
$max_amnt = $this->db->escape_str($max_amnt);
$client = $this->db->escape_str($client);
$basic_data = array(
"prod_name" => $prod_name,
"prod_id" => $prod_id,
"service_type" => $service_type,
"service_gl_acc" => $service_gl_acc,
"min_amnt" => $min_amnt,
"def_amnt" => $def_amnt,
"max_amnt" => $max_amnt,
"client" => $client
);
$this->db->where("services_id=",$services_id);
$this->db->update("services",$basic_data);
}
答案 0 :(得分:0)
1)首先,您应该更改$ this-> db-> where('services_id',$ services_id);行; 2)第二,您应该检查数据库中的数据类型并更新数据值类型。 3)您正在使用escape_str。因此,请使用每个数据值数据类型和db进行确认。