tp框架写了个方法获取顶级分类return结果就是null,在辅助函数都能打印出结果。 本帖最后由 xuzuning 于 2012-09-11 06:32:30 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function getFirst($id_category){ $cate_info=$this->category_obj->where('id_category='.$id_category)->find(); echo $this->category_obj->getLastSql().'<br/>'; if($cate_info['pid']!=0){ $this->getFirst($cate_info['pid']);//这里没有接住返回的数据 }else{ dump($cate_info); return $cate_info; } } function getFirst($id_category){ $cate_info=$this->category_obj->where('id_category='.$id_category)->find(); echo $this->category_obj->getLastSql().'<br/>'; if($cate_info['pid']!=0){ $cate_info .=$this->getFirst($cate_info['pid']); }else{ dump($cate_info); return $cate_info; } } function getFirst($id_category){ $cate_info=$this->category_obj->where('id_category='.$id_category)->find(); echo $this->category_obj->getLastSql().'<br/>'; if($cate_info['pid']!=0){ $cate_info =$this->getFirst($cate_info['pid']); }else{ dump($cate_info); return $cate_info; } } function getFirst($id_category){ $cate_info=$this->category_obj->where('id_category='.$id_category)->find(); echo $this->category_obj->getLastSql().'<br/>'; if($cate_info['pid']!=0){ $cate_info =$this->getFirst($cate_info['pid']); } return $cate_info; }另外我发现你2个查询语句是一样的吧。 求助:怎么对数据库执行多次更新的操作 請問網頁副檔名為.hs是什么意思? php:通过按钮把文本框中的变量传递给一个脚本并执行 各位路过的朋友帮忙看一下,实在想不明白这个问题.!!!!!!1 调用表单的问题,大家帮忙给看下 关于下拉菜单问题。 NULL 问题 soap 和php 中如何返回查询数据库后的几个记录? 请教 preg_ 系列函数中正则表达式的旗标含义! 如何在session中注册一个数组变量,象ASP那样? 页面文字显示正常,对话框乱码!何解? 时间戳的问题和字符集编码的问题
$cate_info=$this->category_obj->where('id_category='.$id_category)->find();
echo $this->category_obj->getLastSql().'<br/>';
if($cate_info['pid']!=0){
$this->getFirst($cate_info['pid']);//这里没有接住返回的数据
}else{
dump($cate_info);
return $cate_info;
}
}
$cate_info=$this->category_obj->where('id_category='.$id_category)->find();
echo $this->category_obj->getLastSql().'<br/>';
if($cate_info['pid']!=0){
$cate_info .=$this->getFirst($cate_info['pid']);
}else{
dump($cate_info);
return $cate_info;
}
}
$cate_info=$this->category_obj->where('id_category='.$id_category)->find();
echo $this->category_obj->getLastSql().'<br/>';
if($cate_info['pid']!=0){
$cate_info =$this->getFirst($cate_info['pid']);
}else{
dump($cate_info);
return $cate_info;
}
}
$cate_info=$this->category_obj->where('id_category='.$id_category)->find();
echo $this->category_obj->getLastSql().'<br/>';
if($cate_info['pid']!=0){
$cate_info =$this->getFirst($cate_info['pid']);
}
return $cate_info;
}
另外我发现你2个查询语句是一样的吧。