php活动记录sql查询不起作用

时间:2012-01-23 00:06:05

标签: activerecord

这项工作:

$position_up = 2;
$rowdata = Subjects::find_by_position($position_up);
echo $rowdata->menu_name; // prints out Equipment..so it works as it echo's well :)

但是这个不起作用它说NULL为什么:

$position_up = 2;
$conditions =array('conditions'=>array('position = ?', $position_up));
$rowdata = Subjects::all($conditions);
var_dump($rowdata->menu_name); //returns NULL ? why ?

1 个答案:

答案 0 :(得分:0)

这有效:

$position_up = 2;
$rowdata = Subjects::find_by_position($position_up);
$rowdata->position = $positionactuelle; //UPDATE that previously selected , Assign $positionactuelle
$rowdata->save(); //SAVE :) ...done updating first one.
unset($rowdata);