我有这样的情况:
if ( $level == 1 ) {
$type = '0';
} elseif ( $level == 2 ) {
$type = '1';
} elseif ( $level == 3 ) {
$type = '(2 or type = 1)'; // This part does not work.
} elseif ( $level == 10 ){
$type = '3';
} else {
return false;
}
$sqlFindParent = 'select count(id) as parent from datable where id = :parent and uType = :type and countryCode = :countryCode';
$findParent = $conn->prepare($sqlFindParent);
$findParent->bindParam(':type',$type);
$type 是动态的。elseif ( $level ==3 )
当我绑定它时,由于其中的原因,它不起作用or
。当然,我可以使用in
,但是您有更好的方法来使用or
它自己吗?