在用户模型数据打印如果我做echo数据。我的问题是如何检索用户控制器中的相同数据,我试图做,但没有奏效。从模型检索数据到控制器
user.php的(模型)
function display_children($parent, $level)
{
$result = mysql_query('SELECT title FROM tree '.'WHERE parent="'.$parent.'"');
while ($row = mysql_fetch_array($result))
{
$data = str_repeat(' ',$level).$row['title']."\n";
// echo $data if i remove comment it display all data
// i m getting all data on this variable $data
$this->display_children($row['title'], $level+1);
}
}
users_controller.php中
public function admin_mlm($id){
pr($this->User->display_children('Food',0)); // function argument work but no data printed here
}
在数据库中是否存在level = 0的一些数据? –
我从用户控制器传递参数,我的数据在模型中正确显示,我有问题如何在控制器中检索相同的数据 –
我想知道为什么你不使用包装类(数据源)作为简单任务。这毕竟是强大框架的主要优势之一。 – mark