php加一句如果在数据库里没某条记录,则显示提示消息。判断语句应该怎么改?求大神抱大腿!
function xuesheng(){
$c=M('case')->field('id')->where("upid=5 and state=1")->findAll();
foreach($c as $k => $v){
$caseid[]=$v['id'];
}
$wherecase=" and cid in (".implode(',',$caseid).")";
$qu=M('news')->field('pic1')->where('state=1'.$wherecase)->group('pic1')->order('order
asc ,id desc')->findAll();
$this->assign('qu',$qu);
if($_POST){
$list=M('news')->where("state=1 and pic1='$_POST[pic1]' and pic='$_POST[pic]' and title='$_POST[title]'".$wherecase)->order('order
asc ,id desc')->findAll();
if($list){
foreach($list as $k => &$v){
$case=M('case')->field('name')->where("id=$v[cid]")->find();
$v['case_name']=$case['name'];
}
}
$this->assign('list',$list);
}
$this->display('xuesheng');
}
如何加一句,如果没有找到相关信息,就提示 对不起,您没有被录取。