如何在数据库列中插入输入$_post
?
"first name=George" and "last name=Kurdahi"
$data = array('name' => $this -> input -> post('first_name') && $this -> input -> post('last_name'))
$this -> db -> insert('submits', $data)
Output: George Kurdahi
答案 0 :(得分:1)
如果您希望将“George Kordahi”字符串插入DB,则应将字符串与.
$data = array('name' => $this->input->post('first_name') . " " . $this->input->post('last_name'))
或者如果您在DB中有'name'和'surname'字段:
$data = array('name' => $this->input->post('first_name'), 'surname' => $this->input->post('last_name'))