Pieter, 
If you use LIKE '%abc%' then this will match 'abc' 'abcs' 'ABC' 'DABCE'
'DABC' and 'ABCD'. It will not match 'AB'. In your case it may work
better if you validate the words before you run your SELECT statement or
make your fields more specific. For example, instead of a field called
descr which can contain '3 bedroom' '3 bedrooms' '3 beds' or even
'3beds' or 'butcher shop' (all of which are different), have a field
called bedrooms and store 3 in it. Obviously this field is no good for a
shop database, but if you are going to mix commercial and non-commercial
property you could either have 2 tables or just keep redundant fields. 

Spelling mistakes: ORACLE has a SOUNDEX() function which returns the
phonetic pronunciation of a word. This can help in fuzzy searches. I
don't know of similar functions in mysql, but it may be easier to use
codes instead: For example: Use drop down lists of valid options - then
your searches will suceed. If this is your first database then you may
want to avoid a full-blown search engine.
Regards,
Andy.

Extraordinaire wrote:
> 
> Hi
> I builded a little propert database. I added a search function to the site
> but have the following problem:
>  I used "SELECT *
> FROM table1 WHERE area ='province' and type like'%type_1%'  and town
> like'%town_1%'  and descr like '%descr_1%' and suburb like '%sub_1%'"
> But it do not do the like thing. If I search for 3 bed and the actual data
> is 3 bedroom it gets the data, but if I search for 3 bedrooms (extra s) it
> do not get it or if I make spelling mistake I do not get a result either. So
> it seems that it rather search for the exact term instead of the like term.
> How can I get it to really search for only a phrase, part of a word or a
> spelling error?
> Regards
> Pieter
> Building extraordinary webs, www.extraordinaire.co.za
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to