[Codeigniter-users] 編集について

Back to archive index

木下敏夫 kino****@tktoo*****
2008年 7月 11日 (金) 11:13:31 JST


木下です。

整理してみると

function edit($cu_id = '')
{
	$cu_id = (int) $cu_id;
	$edit = (int) $this->input->post('edit');
	$this->db->where('cu_id', $cu_id);

	if ($edit == 1)
	{
		$this->db->where('cu_id', $cu_id);
		$query = $this->db->get('customer');
		$row = $query->row();

		$data['cu_name']	= $this->input->post('cu_name');
		$data['cu_kana']	= $this->input->post('cu_kana');
		$data['cu_tel']		= $this->input->post('cu_tel');
		$data['cu_fax']		= $this->input->post('cu_fax');
		$data['cu_mail']	= $this->input->post('cu_mail');
		$data['biko']		= $this->input->post('biko');
		$data['datetime']	= $this->input->post('datetime');

		$this->db->update('customer', $data, $cu_id);		
		$this->load->view('customer_edit_finished');
	}
	else
	{
		$this->load->view('customer_edit_confirm', $data);
	}
}


とならないでしょうか?


>>>>> 	function edit($cu_id = '')
>>>>> 	{
>>>>> 		$cu_id = (int) $cu_id;
>>>>> 		$edit = (int) $this->input->post('edit');
>>>>> 		$this->db->where('cu_id', $cu_id);
>>>>> 		
>>>>> 		if ($edit == 1)
>>>>> 		{
>>>>> 			$this->db->where('cu_id', $cu_id);
>>>>> 			$query = $this->db->get('customer');
>>>>> 			$row = $query->row();
>>>>> 		
>>>>> 			$cu_id		= $row->cu_id;
>>>>> 			$cu_name	= $row->cu_name;
>>>>> 			$cu_kana	= $row->cu_kana;
>>>>> 			$cu_tel		= $row->cu_tel;
>>>>> 			$cu_fax		= $row->cu_fax;
>>>>> 			$cu_mail	= $row->cu_mail;
>>>>> 			$biko		= $row->biko;
>>>>> 			$datetime	= $row->datetime;
>>>>> 			
>>>>> 			$data['cu_name']	= $row->cu_name;
>>>>> 			$data['cu_kana']	= $row->cu_kana;
>>>>> 			$data['cu_tel']		= $row->cu_tel;
>>>>> 			$data['cu_fax']		= $row->cu_fax;
>>>>> 			$data['cu_mail']	= $row->cu_mail;
>>>>> 			$data['biko']		= $row->biko;
>>>>> 			$data['datetime']	= $row->datetime;
>>>>> 			
>>>>> 			$this->db->set('cu_name', $cu_name);
>>>>> 			$this->db->set('cu_kana', $cu_kana);
>>>>> 			$this->db->set('cu_tel', $cu_tel);
>>>>> 			$this->db->set('cu_fax', $cu_fax);
>>>>> 			$this->db->set('cu_mail', $cu_mail);
>>>>> 			$this->db->set('biko', $biko);
>>>>> 			
>>>>> 			$this->db->update('customer', $data, $cu_id);
>>>>> 			$this->load->view('customer_edit_finished');
>>>>> 		}
>>>>> 		else
>>>>> 		{
>>>>> 			$this->load->view('customer_edit_confirm', $data);
>>>>> 		}
>>>>> 	}




Codeigniter-users メーリングリストの案内
Back to archive index