简体   繁体   English

从Zend中的表中选择完全匹配的列...?

[英]Select exact matching columns from table in Zend…?

I am facing a strange issue in my Zend Application: 我在Zend应用程序中面临一个奇怪的问题:

My model is like this: 我的模型是这样的:

 public function checkEmailAndProfileName($emailId, $proName) {
    $select = $this->select()
                     ->where('email_address = ?', $emailId)
                     ->where('profile_name = ?', $proName);
    $result = $this->getAdapter()->fetchRow($select);
 }

Explanation 说明

Suppose I have a row in database with email address "test@test.com" and profile name as "profilename". 假设我在数据库中有一行,电子邮件地址为“test@test.com”,个人资料名称为“profilename”。

Now if I pass following parameters to the model: 现在,如果我将以下参数传递给模型:

$modelObj->checkEmailAndProfileName("test@test.com", "profilename");

It is working fine as I want. 它正如我想的那样正常工作。

Problem 问题

Now If I pass: 现在如果我通过:

$modelObj->checkEmailAndProfileName("test@test.com", "ProfileNAME");

Then it should return false, but strangely it is returning the row of "test@test.com", "profilename". 然后它应该返回false,但奇怪的是它返回“test@test.com”,“profilename”行。 That I don't want... 我不想要......

can anyone help me by telling What I am doing wrong...? 任何人都可以通过告诉我做错了什么来帮助我......?

Thanks In Advance... 提前致谢...

What you need is BINARY of mysql 你需要的是mysql的BINARY

Using BINARY in the WHERE clause forces a match on the binary collation, which in English means that it matches actual characters by their character code, not by whether the characters are deemed equivalent. WHERE子句中使用BINARY强制匹配二进制排序规则,在英语中,它表示它与字符代码匹配实际字符,而不是字符是否被视为等效。

public function checkEmailAndProfileName($emailId, $proName) {
    $select = $this->select()
                     ->where('email_address = ?', $emailId)
                     ->where('BINARY profile_name = ?', $proName);
    $result = $this->getAdapter()->fetchRow($select);
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM