1

このコードは、サーバーとローカルの phpmyadmin の両方でテストされています

  • ローカルホストでは、期待どおりの結果が返されました
  • サーバーでは良い結果が返されましたが、dr_name を渡すと空の結果が返されます。コードは次のとおりです。

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

サーバーとローカルの間の唯一の違いは、サーバーの mysql エンジンが localhost の myisam と innodb であることです。

これは create table ステートメントです。

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