SELECT * FROM ardata
WHERE title REGEXP '.*2000.*'

change that into parameter, but if you want to search on multiple words as
OR, youll have to split them and do separate ORs on tile REGEXP per word, or
rewrite this one something like ".*(2000)|(leagus).*" perhaps, not sure if
grouping is suported by regexp in mysql though




> You could try
>
> SOUNDEX(str)
>
> http://www.mysql.com/doc/en/String_functions.html
>
>
> which might do what you are looking for
>
>
> HTH
>
> Peter
>
> -----Original Message-----
> From: Tom Johnson [mailto:[EMAIL PROTECTED]
> Sent: 26 June 2003 14:23
> To: [EMAIL PROTECTED]
> Subject: Need your help in a search query
>
>
> Hi MySQL Experts,
>
> I am pretty new at this and need your help in figuring out if it is
possible
> to create a query to search for words in a given field.  What I am trying
to
> do is allow a user to enter words to search for a given title in the
> database.  For example, a person is looking up the title "20,000 Leagues
> Under the Sea" but is entering only "20000" as the search criteria.  When
I
> run the following query, I get no results.  The problem is with the comma
in
> 20,000.  Any suggestions on how to find the title even though the user
only
> entered 20000???  I am running this on the web using PHP and MySQL.
> Possible someone knows of a good search script in PHP that might help
also?
>
> Here is the query I was trying to run:
>
> SELECT * FROM ardata
> WHERE title LIKE '%user_input%';
>
> I am using MySQL 4.0.13 and PHP 4.3.2
>
> Thanks for helping!
>
> Tom Johnson
>
>
>
>
> --
> 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]
>
>


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

Reply via email to