[Codeigniter-users] 編集について

Back to archive index

牧尾竜一 ryuic****@jom*****
2008年 7月 11日 (金) 12:05:02 JST


JOMRです。

> では表示させて確認しましょう。
表示させる方法も知りませんでした。

結果は
array(7) { ["cu_name"]=> string(4) "test" ["cu_kana"]=> string(0) ""
["cu_tel"]=> string(0) "" ["cu_fax"]=> string(0) "" ["cu_mail"]=>
string(0) "" ["biko"]=> string(0) "" ["datetime"]=> string(19)
"2008-07-11 12:00:30" } UPDATE customer SET cu_name = 'test', cu_kana =
'', cu_tel = '', cu_fax = '', cu_mail = '', biko = '', datetime =
'2008-07-11 12:00:30' WHERE cu_id = 41

となっています。これはPOSTされたものがないということなのでしょうか?

>> function edit($cu_id = '')
>> {
>> 	$edit = (int) $this->input->post('edit');
>> 	if ($edit == 1)
>> 	{
>> 		$data = array(
>> 			'cu_name' => $this->input->post('cu_name'),
>> 			'cu_kana' => $this->input->post('cu_kana'),
>> 			'cu_tel'  => $this->input->post('cu_tel'),
>> 			'cu_fax'  => $this->input->post('cu_fax'),
>> 			'cu_mail' => $this->input->post('cu_mail'),
>> 			'biko'    => $this->input->post('biko'),
>> 			'datetime'=> date('Y-m-d H:i:s', time()),
>> 		);
> 
> 		//ここに
> 		var_dump($data);
> 		//をいれてdataの内容を確認してみる
>> 		$cu_id = (int) $cu_id;
>> 		$this->db->update('customer', $data, array('cu_id' => 
>> $cu_id));
> 		//ここにSQLを表示させてみる
> 		echo $this->db->update_string('customer', $data, array
> ('cu_id' => $cu_id)); 
>> 		$this->load->view('customer_edit_finished');
>> 	}
>> 	else
>> 	{
> こんな感じで状況を追いかければいいです。
> なぜ更新されないのか?
> 正しく$dataが渡されているのかということですね。
> 




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