Hi,
I’ve to set up a search for a simple
question answer site the user fill in
the question click on a next button
and he/she must see if there is
similar question so I ended up doing like
(the user’s input YourSQL Tricks)
CREATE TABLE IF NOT EXISTS cc_question (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
uid_questioner bigint(20) unsigned NOT NULL,
id_answerer INT UNSIGNED DEFAULT NULL,
title varchar(255) NOT NULL,
notes TEXT DEFAULT NULL,
reply TEXT DEFAULT NULL,
status tinyint(1) NOT NULL default 0 COMMENT '0 the question has not been answered,1 the question has been answered',
in_home tinyint(1) NOT NULL default 0 COMMENT '0 no,1 yes ',
PRIMARY KEY (id),
FULLTEXT (title)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO cc_question (id,uid_questioner,title,) VALUES
(null,34,'MySQL Tutorial'),
(null,45,'How To Use MySQL Well'),
(null,36,'Optimizing MySQL'),
(null,29,'1001 MySQL Tricks'),
(null,12,'MySQL vs. YourSQL'),
(null,31,'MySQL Security');
SELECT * FROM cc_question WHERE MATCH (title) AGAINST ('YourSQL') OR MATCH (title) AGAINST ('Tricks'); // OR ...........
I’m wondering if there is a better way.
What do you about it ?