我一直在输入以下SQL语句,但它没有发现任何结果,我无法弄清楚原因。 phpMyAdmin上的错误显示为:
我希望将此查询用于FULLtext搜索:
SELECT * FROM students WHERE MATCH ( `fname`,`lname` ) AGAINST ('تست')
表格:
-- phpMyAdmin SQL Dump
-- version 3.4.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 08, 2013 at 01:25 PM
-- Server version: 5.5.16
-- PHP Version: 5.3.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `smtmi`
--
-- --------------------------------------------------------
--
-- Table structure for table `students`
--
CREATE TABLE IF NOT EXISTS `students` (
`id` bigint(17) NOT NULL AUTO_INCREMENT,
`user` bigint(17) NOT NULL,
`fname` varchar(100) NOT NULL,
`lname` varchar(100) NOT NULL,
`student_num` bigint(17) NOT NULL,
`national_num` varchar(11) NOT NULL,
`local_birthday` varchar(50) NOT NULL,
`father_name` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `user` (`user`),
FULLTEXT KEY `lname` (`lname`),
FULLTEXT KEY `fname` (`fname`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=33 ;
如何解决?
我使用MYISAM ENGINE和jquery ajax立即发送每个角色。
答案 0 :(得分:3)
只需创建一个新的索引,如:
CREATE FULLTEXT INDEX `lname` (`lname`)