kunitsuji
tsuji****@m-s*****
2008年 7月 11日 (金) 11:31:48 JST
kunitsujiです。
木下さん、どもです。
なんとなくですが、$this->load->view('customer_edit_confirm', $data);
の$dataがひつようなきがしますね^^指摘されていますが。
意図した結果を出すにはこうかな?
IF文の判定のelseいこうですね。
else
{
$cu_id = (int) $cu_id;
$this->db->where('cu_id', $cu_id);
$query = $this->db->get('customer');
if ($query)
{
$row = $query->row();
$data = array(
'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',
}
else
{
//cu_idでデータが取り出せなかった
}
}
>
>kunitsujiさんのも取り入れると
>
>
>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()),
> );
>
> $cu_id = (int) $cu_id;
> $this->db->where('cu_id', $cu_id);
> $this->db->update('customer', $data, $cu_id);
> $this->load->view('customer_edit_finished');
> }
> else
> {
> $this->load->view('customer_edit_confirm', $data);
> }
>}
>
>--
>木下敏夫
>mailto:kino****@tktoo*****
>http://www.tktools.jp/
>http://okusama-shop.com/
>http://www.oidc.jp/bmb/index.php?topic=-m-D14
>-------------------------------------------------------------------------
>ビジネスマッチングブログ・キックオフセミナーにパネリストとして参加します。
>http://www.oidc.jp/bmb/article.php/20080207143305526
>-------------------------------------------------------------------------
>
>_______________________________________________
>Codeigniter-users mailing list
>Codei****@lists*****
>http://lists.sourceforge.jp/mailman/listinfo/codeigniter-users