0
// This will save all the updated values from the user.
$id = $this->input->post('id');
$data = array(
'full_name' => $this->input->post('name'),
'email' => $this->input->post('email'),
'address' => $this->input->post('address'),
'phone' => $this->input->post('phone')
);
// And store user imformation in database.
$cust_id = $this->cart_model->update_customer($data, $id);
$order = array(
'orderDate' => date('Y-m-d'),
'customerid' => $cust_id
);
// And store user order information in database.
$ord_id = $this->cart_model->insert_order($order);
我的模型
function update_customer($data, $id)
{
$this->db->where('id', $id);
$this->db->update('user', $data);
$id = $this->db->insert_id();
return (isset($id)) ? $id : FALSE;
}
// Insert order date with customer id in "orders" table in database.
public function insert_order($data)
{
$this->db->insert('order', $data);
$id = $this->db->insert_id();
return (isset($id)) ? $id : FALSE;
}
表順序:id
,orderDate
,customerid
表用戶:id
,full_name
,address
,phone
表訂單價值0
不一樣的用戶表,哪裏是我的錯,請customerid
corected 感謝
謝謝你運行是succesfull – Anonymous