Reputation: 21
I have been entering the following SQL statement, but it has not been turning up any results and I cannot figure out why. The error on phpMyAdmin reads:
i want use this query for a FULLtext search:
SELECT * FROM students WHERE MATCH ( `fname`,`lname` ) AGAINST ('تست')
for this table:
-- 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 ;
how to fix it?
i use MYISAM ENGINE and jquery ajax for sending instant every character.
Upvotes: 2
Views: 4377
Reputation: 461
Just create a new index like :
CREATE FULLTEXT INDEX `lname` (`lname`)
Upvotes: 3