Re: Mysql Search

From: Tim Johansson (spam_at_gurka.se)
Date: 05/02/04


Date: Sun, 2 May 2004 21:27:28 +0200

Try using explode() to put the data into an array, then searching them with
in_array().

--
--
www.gurka.se/gurka.php?x=1&language=english
Tremble before the mighty Cucumber
"Krzysztof Piotrowski" <piotrowskikrzysztof@gazeta.pl> skrev i meddelandet
news:c73b6r$jsf$1@inews.gazeta.pl...
> Philip,
>
> I'm not sure if I understand how your database looks like does - does it
> store only single words in designkw column or more than one word per cell?
>
> If you have many words in this field you should try using %
".$searchword."
> % (with spaces after and before %). This way you could pick only rows
having
> whole words, however you will omit words at the beginning and end of the
> cell...
>
> If you story only one word per designkw field, you could easily go for
> designkw = '" . $searchword . "' - but that's probably not the case
>
> Hope this somehow could help you.
>
> Chris Columbus
>
>
> "Philip WATTS" <PRWATTS@syringa.freeserve.co.uk> wrote in message
> news:c736k2$1fh$1@news7.svr.pol.co.uk...
> > 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?
> >
> >
> >
> >
>
>


Relevant Pages

  • Re: Mysql Search
    ... I'm not sure if I understand how your database looks like does - does it ... store only single words in designkw column or more than one word per cell? ... The user inputs a search word to an HTML form which then ... > has that single letter anywhere in it. ...
    (alt.php)
  • RE: Database running over network runs extremely slow
    ... I have reports built into the database that track the entry ... you are searching (or using in your DLOOKUPs criteria parameter)? ... of the DLookups to looped recordset searches, ...
    (microsoft.public.access.tablesdbdesign)
  • Re: How many names and addresses can you have for ID card
    ... large amount of database space, ... Searching CLOBs is thus memory and CPU-intensive, ... A directory system a la LDAP or X.500 would be a much more natural ... An entry may have any number of atrributes which are ...
    (uk.legal)
  • Re: Is there anynone who knows a chatting site or someting like this? - Face Matching
    ... and then you would search your database to find matching ... advance by searching the internet retrieving ... URL and the feature vector to your database. ... You would compare the ...
    (sci.image.processing)
  • Re: What are the other options against Zope?
    ... >> a web app that googles into my companies proprietary database. ... The web part, or the searching part? ... > database interfaces other than to its own ZODB. ...
    (comp.lang.python)