Sticky Mysql query issue driving me nuts!

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dpomije
Forum Newbie
Posts: 1
Joined: Sun Jan 23, 2005 12:19 am

Sticky Mysql query issue driving me nuts!

Post by dpomije »

I've got a games mysql database with a search function. The problem is, the proper names of the games are ones like "Half-Life 2" or "Call of Duty: United Offensive"

When someone does a search for "half life 2" without the dash, or "call of duty unitied offensive" without the colon, the result will not show up.

Is there a way to construct a query that will basically match the result even if the user doesn't enter a colon, dash or whatever character?

this is what I'm doing currently. Very simple as you can see.

$query = "select NAME OF GAME from GAME TABLE where NAME OF GAME like '%$user query%'

I would appreciate any insight. If you're a gamer and a coder, help me out!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

search around on "full-text searching"
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Post by AGISB »

Besides full text searching you can also splitt the search into words and use like with each of the words.
Post Reply