Thanks for checking. All helpful answers/comments are up voted. I have the following code, which does the job, but imo is not efficient. The reason I think it's not efficient is because I'm using fetchAll + loop even though I know that the query will return either 1 or no records.
//assume the usual new PDO, binding, and execute are up here
$myval = "somevalue";
$res = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (!$res) {
    //no record matches
    //BLOCK A CODE HERE
} else { 
    //found matching record (but always going to be 1 record, no more)	
    foreach($res as $row) {
    	if ($myval == $row['val']){
    		//myval is the same as db
    		//BLOCK B CODE HERE
    	} else {
    		//myval is different from db
    		//BLOCK C CODE HERE
    	}
    }//foreach
}
Nasıl ben (ben her zaman 1 veya 0 tek kayıt olacak biliyorum dikkate alınarak) foreach ve fetchAll hantal görünümünü kaldırmak için artırabilir? Ben idam böylece Ama yine benzer kontrol noktaları ihtiyaç aynı BLOCK A BLOCK B BLOCK C Benim şimdiki mantık ihtiyacı olarak.
 
			