我已经使用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'和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 ;