牧尾竜一
ryuic****@jom*****
2008年 7月 11日 (金) 10:22:42 JST
JOMRです。
> こんにちは。
> $this->db->update('customer', $data, $cu_id);
> この部分ですが、
> $where "`cu_id` = " . $cu_id;
> とするか
ここが少し理解しづらかったので
$this->db->update('customer', $data, array('cu_id' => $cu_id));
と置き替えてみたら編集完了画面に移るんですが内容は編集されませんでした。
> もう一度SETの後に
> $this->db->where('cu_id', $cu_id);
> を走らせるかですかね。
SETの次の行に追加したのですがエラー内容は同じでした。
JOMRです。
>> Kenjiさんお世話になります。
>>
>>
>>>> 前回に引き続きデータ編集できるメソッドを作成しました。
>>>> ただこれだと、editにいくと「 レコードを更新するには、"set" メソッドを使
>>>> う必要があります。 」といったエラーになってしまいます。
>>> update()メソッドに更新データが渡されていません。
>>>
>>> $this->db->update('customer');
>>>
>>> 『徹底入門』ですと、p.429 を参照願います。
>> 以下のようにしたのですが
>> 「 Unknown column '42' in 'where clause'
>>
>> UPDATE `customer` SET `cu_name` = 'test', `cu_kana` = NULL, `cu_tel` =
>> NULL, `cu_fax` = NULL, `cu_mail` = NULL, `biko` = NULL, `datetime` =
>> '2008-07-09 20:50:58' WHERE `42` IS NULL 」
>>
>> といったエラーになってしまいました。
>>
>> 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 mailing list
> Codei****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/codeigniter-users
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.grisoft.jp
> Version: 8.0.138 / Virus Database: 270.4.7/1545 - Release Date: 2008/07/10 18:43
>
>
>