我对 Kohana 和 ORM 有一些问题。
我想更新一个
column = column + 1
那它!就如此容易。
我尝试了很多方法并且总是重复计数,例如:
initial column value = 0
column = column + 1
result = 3 (how is this possible???)
这些是方法,没有任何工作......
这是很多尝试,但没有任何效果:(
public function update_views()
{
$this->set('column', DB::expr('column + 1'))->save();
}
public function update_views()
{
$this->set('column', $this->column + 1)->update();
}
public function update_views()
{
DB::update('table')->set(array('column' => DB::expr('column + 1')))->where('id', '=', $this->id)->execute(); // this was my last hope and nothing....
}
这三个工作完美,没有错误,没有任何东西......就在我检查数据库上的表格时不是我想要的......有什么建议吗?请告诉我。
谢谢。