Mysql Search
From: Philip WATTS (PRWATTS_at_syringa.freeserve.co.uk)
Date: 05/02/04
- Next message: Moziah: "Re: php news/blog"
- Previous message: Paul Delannoy: "Re: PHP & GSM Modem Devices"
- Next in thread: Krzysztof Piotrowski: "Re: Mysql Search"
- Reply: Krzysztof Piotrowski: "Re: Mysql Search"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 2 May 2004 16:49:20 +0100
I am not sure if this is a PHP or MySql problem, so here goes!
I have a MySql database which has a field containing a list of words (comma
seperated). The user inputs a search word to an HTML form which then
searches this database field for a match, and prints out other fields from
that datbase record if there is a match.
Currently I have used:-
$query="select * from design where designkw like '%".$searchword."%'";
If the user inputs just a single letter, then this returns every field that
has that single letter anywhere in it. I only want an exact match.
Is there a simple way to overcome this?
Currently I am thinking that I must load the field into a PHP variable and
use strcmp() with this variable and the users input. Would this approach be
sensible?
- Next message: Moziah: "Re: php news/blog"
- Previous message: Paul Delannoy: "Re: PHP & GSM Modem Devices"
- Next in thread: Krzysztof Piotrowski: "Re: Mysql Search"
- Reply: Krzysztof Piotrowski: "Re: Mysql Search"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|