2016-03-16 158 views
0

我通過理論和Zend框架的2個工作,並同時更新控制器類代碼中,我得到了以下錯誤消息SQLSTATE [HY000]:常規錯誤:1267排序規則的非法組合的Zend 2

Undefined method 'getFkcountryByName'. The method name must start with either findBy or findOneBy!

$country = $entityManager->getRepository('\Synchro\Entity\Geographicalarea')->getFkcountryByName($geographical ['nom_departement']); 

我下定決心,通過增加實體庫的NOM,但現在我得到這個錯誤:

An exception occurred while executing 'SELECT c0_.idCountry AS idCountry_0, c0_.codeCountry AS codeCountry_1, c0_.nameCountry AS nameCountry_2 FROM country c0_ WHERE c0_.nameCountry = 'Pyr�n�es-Atlantiques'':

SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='

我該如何解決呢?

感謝

+0

請參閱http://stackoverflow.com/questions/1008287/illegal-mix-of-collat​​ions-mysql-error –

+0

在您的WHERE子句中使用COLLATE:[在SQL語句中使用COLLATE](https:///dev.mysql.com/doc/refman/5.7/en/charset-collat​​e.html) –

+0

@ ZamronyP.Juhara ok在此先感謝 –

回答

1

嘗試

country = $entityManager->getRepository('\Synchro\Entity\Geographicalarea')->getFkcountryByName(utf8_encode($geographical ['nom_departement'])); 

關鍵點需要注意的是函數utf8_encode();

相關問題