1

此代码使用服务器和本地 phpmyadmin 进行了测试

  • 在本地主机上,它按预期返回了结果
  • 在服务器上它返回了一个很好的结果,但是在传递 dr_name 时它返回空结果这里是代码:

SELECT * FROM doctor WHERE dr_name LIKE '%غا%' AND specialization=12 AND state=6

server 和 local 之间的唯一区别是 server mysql 引擎是 localhost 上的 myisam 和 innodb

这是创建表语句:

CREATE TABLE IF NOT EXISTS `doctor` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `dr_name` varchar(65) NOT NULL,
  `dr_name_e` varchar(65) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `unique_name` varchar(75) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `pass` char(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `nickname` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `specialization` int(11) NOT NULL,
  `state` tinyint(4) NOT NULL,
  `scientific_degree` int(11) DEFAULT NULL,
  `university` int(11) DEFAULT NULL,
  `grad_year` smallint(6) DEFAULT NULL,
  `show_degree` tinyint(1) DEFAULT NULL,
  `show_univ` tinyint(1) DEFAULT NULL,
  `show_grad_year` tinyint(1) DEFAULT NULL,
  `appendices` varchar(1000) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `picture` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `active` tinyint(1) NOT NULL DEFAULT '0',
  `views` bigint(20) DEFAULT '0',
  `search_result` bigint(20) DEFAULT '0',
  `gender_male` tinyint(1) DEFAULT NULL,
  `agent` int(11) DEFAULT NULL,
  `next_step` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_name` (`unique_name`),
  KEY `university` (`university`),
  KEY `scientific_degree` (`scientific_degree`),
  KEY `specialization` (`specialization`),
  KEY `agent` (`agent`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=31 ;
4

0 回答 0