php if语句判定ms查询是否为空

$select_re_id=$cnx->query("select count(*) c from Yid where pid='".$pid."' and gid='".$gid."' and prid='".$prid."' and cid='".$cid."' and did='".$did."'");//判定是否为空
foreach($select_re_id as $reid){
if ($reid['c']=='0'){
$cnx->query("INSERT INTO Yid (pid,gid,prid,cid,did) VALUES ('".$pid."','".$gid."','".$prid."','".$cid."','".$did."')");//添加语句
}else{
echo "此组合已经存在!";
}

 

posted @ 2015-01-04 08:27  fleam  阅读(263)  评论(0编辑  收藏  举报