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 "此组合已经存在!";

}

 

你可能感兴趣的:(PHP)