mysql查询问题:操作'='的非法混合排序(latin1_swedish_ci,IMPLICIT)和(utf8_general_ci,COERCIBLE)

时间:2016-04-29 04:51:32

标签: php mysql utf-8 oscommerce

我使用的是php5.3并已使用“SET NAMES utf8”; 我正在使用oscommerce。

PHP代码:

tep_db_query("SET NAMES utf8");

$result = tep_db_fetch_array(tep_db_query("select customers_email_address from  customers where customers_firstname='" . tep_db_input($fname) . "' AND customers_lastname='" . tep_db_input($lname) . "'"));

我的查询和错误如下:

  

1267 - 非法混合排序(latin1_swedish_ci,IMPLICIT)和   (utf8_general_ci,COERCIBLE)用于操作'='

     

从客户中选择customers_email_address,其中customers_firstname ='Robert'AND customers_lastname ='OÂ~iaas'

     

[TEP STOP]

表格结构如下。我无法更新数据库结构

--
-- Table structure for table `customers`
--

CREATE TABLE IF NOT EXISTS `customers` (
  `customers_id` int(11) NOT NULL AUTO_INCREMENT,
  `customers_gender` char(1) DEFAULT NULL,
  `customers_firstname` varchar(255) NOT NULL,
  `customers_lastname` varchar(255) NOT NULL,
  `customers_dob` varchar(30) DEFAULT NULL,
  `customers_email_address` varchar(255) NOT NULL,
  PRIMARY KEY (`customers_id`),
  KEY `idx_customers_email_address` (`customers_email_address`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=18109 ;

0 个答案:

没有答案