如何在 Kohana 3.0 中更新记录
我想更新表中的一条记录。我正在使用 Kohana 3.0 和 ORM。我的代码如下 -
$photo_sel = $this->where('id','=',$this_photo_id)
->where('user_id','=',$user_id)
->where('is_logo','=','0')->find();
if ($photo_sel->loaded()) {
$this->photo_file_name = $photo;
parent::save();
}
但每次更新第一条记录时。相反,我想使用 $this_photo_id 选择并更新记录。
我怎样才能做到这一点?
I want to update a record in a table. I'm using Kohana 3.0 and ORM. My code is as follows -
$photo_sel = $this->where('id','=',$this_photo_id)
->where('user_id','=',$user_id)
->where('is_logo','=','0')->find();
if ($photo_sel->loaded()) {
$this->photo_file_name = $photo;
parent::save();
}
But every time the first record is updated. Instead I want to select and update the record with $this_photo_id.
How can I achieve this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果要更新选定的记录,只修改并保存该记录:
If you want to update the selected record, modify and save this record only: